110,535
社区成员
发帖
与我相关
我的任务
分享
int rowCount = -1;
string sql = "exe_proLogined";\\存储过程
try
{
SqlCommand cmd = new SqlCommand(sql, DBHelper.conn);\\创建sqlcommand对象
cmd.CommandType = CommandType.StoredProcedure;\\设置类型为存储过程
cmd.Parameters.Add("@Acount", SqlDbType.VarChar, 30).Value = acount;\\为为存储过程参数赋值
cmd.Parameters.Add("@passWord", SqlDbType.VarChar, 20).Value = pwd;\\为为存储过程参数赋值
DBHelper.conn.Open();\\打开连接
rowCount = int.Parse(cmd.ExecuteScalar().ToString());\\执行返回结果
}
catch (Exception ex)
{
throw ex;
}
finally
{
DBHelper.conn.Close();\\关闭连接
}
return rowCount;