该怎么解决?
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection( "user id=hxh;password=20080712;initial catalog=hxh;server=XINAN0107\\SQLEXPRESS");
conn.Open();
SqlCommand comm=new SqlCommand("SELECT * FROM Student",conn);
SqlDataAdapter da = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
da.Fill(ds, "Student");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
DataTable dt = ds.Tables["Student"];
dt.Rows[1]["age"] = "9"; DataRow row = dt.NewRow();
row["name"] = "d";
row["age"] = "21";
row["course"] = "物理";
dt.Rows.Add(row); textBox1.Text = dt.Rows[3]["name"].ToString();
textBox2.Text = dt.Rows[3]["age"].ToString();
textBox3.Text = dt.Rows[3]["course"].ToString(); da.Update(dt); }
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection( "user id=hxh;password=20080712;initial catalog=hxh;server=XINAN0107\\SQLEXPRESS");
conn.Open();
SqlCommand comm=new SqlCommand("SELECT * FROM Student",conn);
SqlDataAdapter da = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
da.Fill(ds, "Student");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
DataTable dt = ds.Tables["Student"];
dt.Rows[1]["age"] = "9"; DataRow row = dt.NewRow();
row["name"] = "d";
row["age"] = "21";
row["course"] = "物理";
dt.Rows.Add(row); textBox1.Text = dt.Rows[3]["name"].ToString();
textBox2.Text = dt.Rows[3]["age"].ToString();
textBox3.Text = dt.Rows[3]["course"].ToString(); da.Update(dt); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货