使用Visual Studio自带数据库配合SqlDataReader 读取数据库数据
连接语句:
string strConn = "";
SqlConnection myConn = new SqlConnection(strConn);
string strSql = "select * from grxx";
SqlCommand myCommand = new SqlCommand(strSql, myConn);
myConn.Open();
SqlDataReader myReader = myCommand.ExecuteReader();
myGv.DataSource = myReader;
myGv.DataBind();
myReader.Close();
转载于:https://blog.51cto.com/dmnet/1870071