Advertisement

C#连接SQLServer实现登录界面

阅读量:
复制代码
    private void button1_Click(object sender, EventArgs e)
        {
            string usr = this.textBox1.Text.Trim();
            string pass = this.textBox2.Text.Trim();
            if (usr.Equals("") || pass.Equals(""))
            {
                MessageBox.Show("用户名和密码不能为空!");
                return;
            }
            else
            {
                string constr = "server=LAPTOP-H6RRB219;database=system;uid=ss;pwd=liujia66";
                SqlConnection conn = new SqlConnection(constr);
                conn.Open();
                string sql = "select * from login whe

全部评论 (0)

还没有任何评论哟~