注册 登录
编程论坛 SQL Server论坛

if语句怎么连接数据库中表的任意变量 if(?????)

程诗亮 发布于 2010-12-14 12:37, 566 次点击
SqlConnection con = new SqlConnection(@"server=;uid=;pwd=;database=;");
            string username,pwd;
            username = txtusername.Text;
            pwd = mima.Text;
            string strsql ="Select * From qq Where username = '" + txtusername.Text.Trim() + "' And pwd = '" + mima.Text.Trim() + "'";

            if (txtusername.Text == "" && mima.Text == "")
            {
                MessageBox.Show("请检查密码是否正确");

            }
           else if (username!=null && mima!=null)
            {

                MessageBox.Show("验证成功");
            }

            else
            {
                MessageBox.Show("账号或密码不存在");
            }
0 回复
1