主题:帮忙看下哪错了?
哪位高手帮看一下,哪个地方有错误?谢谢!
本来想让在表格中显示出来数据库中的内容的,但是结果表格中却是其他东西(比如 desingmode,tablename 等列)。datagrid 已经拖放到面板上了。名字为mydg.
using.......
string strconn="server=myserver;database=student;uid=sa;pwd=";
SqlConnection myconn=new SqlConnection(strconn);
myconn.Open();
SqlCommand mycmd=new SqlCommand ("select sname,sno from student",myconn);
SqlDataAdapter myda=new SqlDataAdapter("select sname,sno from student", myconn);
DataSet myds=new DataSet();
myda.Fill (myds,"student");
mydg.DataSource=myds.Tables;
mydg.DataBind( );
myconn.Close ( );
本来想让在表格中显示出来数据库中的内容的,但是结果表格中却是其他东西(比如 desingmode,tablename 等列)。datagrid 已经拖放到面板上了。名字为mydg.
using.......
string strconn="server=myserver;database=student;uid=sa;pwd=";
SqlConnection myconn=new SqlConnection(strconn);
myconn.Open();
SqlCommand mycmd=new SqlCommand ("select sname,sno from student",myconn);
SqlDataAdapter myda=new SqlDataAdapter("select sname,sno from student", myconn);
DataSet myds=new DataSet();
myda.Fill (myds,"student");
mydg.DataSource=myds.Tables;
mydg.DataBind( );
myconn.Close ( );