关于更新数据库
本例主要是实现学生成绩的增、删、改、查功能。
在本例中,使用DataAapter向SQL Server 2005中的Students数据库修改数据。
在Students数据库中有一个表tbl_studentlist,其结构如图10-14所示。
示例窗口如图10-15所示。
498)this.style.width=498;" height=144<   
图10-14  tbl_studentlist表结构  
498)this.style.width=498;" height=287<   
(点击查看大图)图10-15  示例窗口  
(1)"添加"按钮代码:
private void button1_Click(object sender, System.EventArgs e)  {      //创建一新行        DataRow newrow = dsStudent.tbl_studentList.NewRow();         //为每个字段赋值        newrow[0] = t_xh.Text;        newrow[1] = t_xm.Text;        newrow[2] = t_bj.Text;        newrow[3] = t_kc.Text;        newrow[4] = t_lx.Text;        newrow[5] = t_cj.Text;        newrow[6] = t_xf.Text;         //将赋值后的行添加到表中        dsStudent.tbl_studentList.Rows.Add(newrow);         //使用GetChangges获取新增的行        DataSet newds = dsStudent.GetChanges();         //将新增的行更新回数据源        daStudent.Update(newds);         //让DataSet接受更新        dsStudent.AcceptChanges();  }  
这是书上的例子,我想请教各位下,代码中的daStudent 和 dsStudent对应的是什么? 我看了半天,dsStudent应该是mdb文件名生成的DataSet吧,但是daStudent对应的是什么就不知道了,求大牛指教。。。
------解决方案--------------------