DataSet ds = new DataSet();
SqlDataAdapter adap = null; private void Form3_Load(object sender, EventArgs e)
{
SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
sb.DataSource = @".\sqlexpress";
sb.InitialCatalog = "data";
sb.IntegratedSecurity = true;
string path = "select * from xsxx";
SqlConnection she = new SqlConnection(sb.ConnectionString);//链接字符串;
SqlCommand li = new SqlCommand(path, she); she.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from xsxx order by number desc ", she);
da.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0]; she.Close(); //
} SqlCommandBuilder sb = new SqlCommandBuilder(adap);
adap.Update(ds);
我要的是对表进行修改后保存;
但是出现错误;
// 未将对象引用设置到对象的实例。
这是什么意思啊!我找不到答案;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货