string sqlStr = string.Format("Select count(*) fr
stringsqlStr=string.Format("Selectcount(*)fromStudentwhereStudent_ID='{0}'andPassword...
string sqlStr = string.Format("Select count(*) from Student where Student_ID='{0}'and Password='{1}'", txtUserName.Text.Trim(), txtUserPassWord.Text.Trim());
using (SqlConnection conn = new SqlConnection(connString.ConnectionString))
{
SqlCommand cmd = new SqlCommand(sqlStr, conn);
conn.Open();
int n = Convert.ToInt32(cmd.ExecuteScalar());
if (n == 1)
{
MessageBox.Show("登陆成功");
}
我单步执行时到 int n=Convert.……这句话时就报错? 展开
using (SqlConnection conn = new SqlConnection(connString.ConnectionString))
{
SqlCommand cmd = new SqlCommand(sqlStr, conn);
conn.Open();
int n = Convert.ToInt32(cmd.ExecuteScalar());
if (n == 1)
{
MessageBox.Show("登陆成功");
}
我单步执行时到 int n=Convert.……这句话时就报错? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |