cmd.CommandText = "select * from LogIn where username = @username and password = @password"; cmd.Parameters.Add(new SqlParameter("username", userName)); cmd.Parameters.Add(new SqlParameter("password", password)); int i =Convert.ToInt32(cmd.ExecuteScalar()); if (i > 0) Console.WriteLine("登陆成功!"); else Console.WriteLine("登陆失败!用户名或密码错误!");
SQL 占位符
最新推荐文章于 2024-09-30 14:39:51 发布