datalist控件的数据库问题
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string MySqlConnection = "user id=sa;password=;Database =pubs;data source=127.0.0.1;Connect Timeout=30 ";
SqlConnection conn = new SqlConnection(MySqlConnection);
string sql = "select * from stores ";
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
DataList1.DataSource = dr;
DataList1.DataBind();
conn.Close();
}
什么错都没有报 运行结果什么都看不见 就是一个空白网页
------解决方案--------------------换成dataset看看。