2018.09.16 命令参数的使用

Posted holiday-l

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2018.09.16 命令参数的使用相关的知识,希望对你有一定的参考价值。

private void btn_Login_Click(object sender, EventArgs e)
{
SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString =
"Server=(local);Database=EduBaseDemo;Integrated Security=sspi";
SqlCommand sqlCommand = sqlConnection.CreateCommand();

sqlCommand.CommandText =

"SELECT COUNT(1) FROM tb_User WHERE [email protected] AND Password=HASHBYTES(‘MD5‘,@Password);")
SqlParameter sqlParameter = new SqlParameter(); 
sqlParameter.ParameterName = "@No"; 
sqlParameter.Value = this.UserNo.Text.Trim(); 
sqlParameter.SqlDbType = SqlDbType.Char; 
sqlParameter.Size = 10; 
sqlCommand.Parameters.Add(sqlParameter); 
sqlConnection.Open();
int rowCount = (int)sqlCommand.ExecuteScalar(); 
sqlConnection.Close(); 
if (rowCount == 1) 
{
MessageBox.Show("登录成功。"); 
}
else 
{
MessageBox.Show("用户号/密码有误,请重新输入!"); 
this.Password.Focus(); 
this.Password.SelectAll(); 
}
}


























以上是关于2018.09.16 命令参数的使用的主要内容,如果未能解决你的问题,请参考以下文章

如何在C++中解析命令行参数

allure命令行参数

curl命令行参数及使用

SQL*Loader详细使用教程:命令行参数

Python笔记:命令行参数解析

eclipse中如何使用命令行参数