主题:求解
下列程序是与SQL SERVER连接的,我测试连接可以连接成功,但下面的不成功,那位高手指点一下
SqlConnection Conn;
Conn=new SqlConnection("server=CHEN;database=chat;uid=sa;pwd=''");
Conn.Open();
//string sqlstr="insert into user (nicheng,mima) values (222,222)";
string sqlstr="select * from user ";
SqlCommand Comm=new SqlCommand(sqlstr,Conn);
SqlDataReader dr=Comm.ExecuteReader();
dg.DataSource=dr;
dg.DataBind();
Conn.Close();
//Response.Redirect("11.aspx");
}
SqlConnection Conn;
Conn=new SqlConnection("server=CHEN;database=chat;uid=sa;pwd=''");
Conn.Open();
//string sqlstr="insert into user (nicheng,mima) values (222,222)";
string sqlstr="select * from user ";
SqlCommand Comm=new SqlCommand(sqlstr,Conn);
SqlDataReader dr=Comm.ExecuteReader();
dg.DataSource=dr;
dg.DataBind();
Conn.Close();
//Response.Redirect("11.aspx");
}