我需要创建一个简单的登录页面并在 Rows 上收到错误...
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server=AMR\\DEV1;UID=po;PWD=12W; database=POM;");
con.Open();
SqlCommand cmd = new SqlCommand("select * from budget where id='" + TextBox1.Text + "' and amount='" + TextBox2.Text + "'", con);
DataSet ds = new DataSet();
ds.Clear();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
if (ds.Rows.Count > 0) {
Session["user"] = TextBox1.Text;
Response.Redirect("Default2.aspx");
} else {
TextBox1.Text = "";
TextBox2.Text = "";
Label1.Text = "Invalid Login Details!";
}
}