我收到的错误是“'用户'附近的语法不正确” - 但是,我看不出我的代码有什么问题 - 有人有什么想法吗?
protected void Page_Load(object sender, EventArgs e)
{
string db = "";
db = ConfigurationManager.ConnectionStrings["myConnection"].ConnectionString;
SqlConnection con = new SqlConnection(db);
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SELECT * FROM user";
cmd.Connection = con;
SqlDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read())
{
Response.Write(dr[0].ToString());
Response.Write(dr[1].ToString());
Response.Write(dr[2].ToString());
Response.Write(dr[3].ToString());
}
con.Close();
}