首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

三层架构得简单有关问题,新手求教

2012-01-30 
三层架构得简单问题,新手求教publicDataTableGetAllByID(intEmployeeID){DataTabledtnewDataTable()SqlC

三层架构得简单问题,新手求教
public   DataTable   GetAllByID(int   EmployeeID)
                {
                        DataTable   dt   =   new   DataTable();
                        SqlConnection   mathConnection   =   new   SqlConnection(ConfigurationManager.ConnectionStrings[ "SQLConnections "].ToString());
                        SqlCommand   scmd   =   new   SqlCommand();

                        this.scmd   =   new   SqlCommand( "GetAllByID ",   mathConnection);
                        this.scmd.CommandType   =   CommandType.StoredProcedure;
                        SqlDataAdapter   sAda   =   new   SqlDataAdapter( "GetAllByID ",   mathConnection);
                        sAda.SelectCommand   =   scmd;
                        sAda.SelectCommand.CommandType   =   CommandType.StoredProcedure;
                        this.scmd.Parameters.Add( "@myid ",   SqlDbType.Int);
                        this.scmd.Parameters[ "@myid "].Value   =   EmployeeID;

                        try
                        {
                                this.mathConnection.Open();
                                this.scmd.ExecuteNonQuery();
                                this.sAda.Fill(ds);
                                this.mathConnection.Close();
                        }
                        catch
                        {
                                throw   null;
                        }
                        return   dt;
                }
帮我看看有什么问题?谢谢!
编译不出错,运行绑不出数据!存储过程没有问题!求教

[解决办法]
把this去掉吧
[解决办法]
把this去掉!

热点排行