提示 未将对象引用设置到对象的实例。 sda.SelectCommand.Connection = con;错误,一下是源代,怎么解决
sda.SelectCommand.Connection = con;
- C# code
SqlConnection con = Ares.WebSite.App_Code.DB.CreateConn(); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand.Connection = con; sda.SelectCommand.CommandText = "select * from M_SalesTab"; DataSet ds = new DataSet(); sda.Fill(ds); Response.Write(ds.Tables[0].Rows[0][1].ToString());
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------