小编yas*_*ash的帖子

在登录页面3 - 轮胎架构中遇到麻烦

商务访问层:

    public static int login(string userlogin, string pwdlogin)
    {
        SqlConnection con = new SqlConnection();
        con.ConnectionString = GetConnectionString();
        con.Open();
        int id = 0;
        string selectstr = "SELECT UserName, Password FROM Registration WHERE UserName = '" + userlogin.Trim() + "' AND Password = '" + pwdlogin.Trim() + "'";
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = selectstr;
        cmd.CommandType = System.Data.CommandType.Text;
        cmd.Connection = con;
        id = cmd.ExecuteNonQuery();
        cmd = null;
        con.Close();
        return id;
    }
Run Code Online (Sandbox Code Playgroud)

Login.cs

 protected void Button1_Click(object sender, EventArgs e)
    {
        int id …
Run Code Online (Sandbox Code Playgroud)

c# database-connection 3-tier

-4
推荐指数
1
解决办法
841
查看次数

标签 统计

3-tier ×1

c# ×1

database-connection ×1