请帮帮我 是SYNTAX ERROR?或者......数据库问题?
我找不到问题
[
答案 0 :(得分:0)
抱歉,我没有写清楚
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class account_login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Login_Click(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection("Server=163.17.9.63;Database=DB1_xx;User Id=DB1_xx;Password=DB1_xx; ");
Conn.Open();
SqlDataReader dr;
SqlCommand cmd = new SqlCommand("Select * From db_account Where account='" + account.Text + "' and password = '" + password.Text + "'", Conn);
dr = cmd.ExecuteReader();
if (!dr.Read())
{
Label1.Text = "error!";
cmd.Cancel();
dr.Close();
Conn.Close();
Conn.Dispose();
}
else
{
Session["Login"] = "OK";
Session["name"] = dr["name"].ToString();
Session["rank"] = dr["rank"].ToString();
cmd.Cancel();
dr.Close();
Conn.Close();
Conn.Dispose();
Response.Write("<script>alert('success!!!');location.href='../main.aspx'</script>");
}
}
}