主题:数据库有记录,为何显示不出来
string myvar;
string strSql="select title,content from bulletin order by id desc";
myvar=ConfigurationSettings.AppSettings["connstring"];
SqlConnection objConnection=new SqlConnection(myvar);
//SqlCommand myComm=new SqlCommand(strSql,objConnection);
//myComm.Connection.Open();
SqlDataAdapter objDataAdapter=new SqlDataAdapter(strSql,objConnection);
DataSet objDataSet=new DataSet();
objDataAdapter.Fill(objDataSet,"bulletin");
DataView objDataView=new DataView(objDataSet.Tables["bulletin"]);
DataGrid1.DataSource=objDataView;
DataGrid1.DataBind();
string strSql="select title,content from bulletin order by id desc";
myvar=ConfigurationSettings.AppSettings["connstring"];
SqlConnection objConnection=new SqlConnection(myvar);
//SqlCommand myComm=new SqlCommand(strSql,objConnection);
//myComm.Connection.Open();
SqlDataAdapter objDataAdapter=new SqlDataAdapter(strSql,objConnection);
DataSet objDataSet=new DataSet();
objDataAdapter.Fill(objDataSet,"bulletin");
DataView objDataView=new DataView(objDataSet.Tables["bulletin"]);
DataGrid1.DataSource=objDataView;
DataGrid1.DataBind();