执行数据库,这有啥区别??

来源:百度知道 编辑:UC知道 时间:2024/09/21 12:46:55
//4. 修改密码
public static bool ChangePwd(int UserId, string UserPwd)
{
bool Flage = false;
string procname = "dbo.ChangePwd";
SqlParameter[] prams = {
new SqlParameter("@UserId",SqlDbType.Int),
new SqlParameter("@UserPwd",SqlDbType.VarChar,100)
};
prams[0].Value = UserId;
prams[1].Value = UserPwd;
int intResult = DataBase.RunExecute(procname, prams);
if (intResult > 0)
{
Flage = true;
}

return Flage;
}

//5. 登录验证
public static bool ValidateUser(string UserName, string UserPwd)
{
bool Flage = false;
string procname = "dbo.ValidateUser";
SqlParameter[] prams = {

RunExecute,返回的是执行影响的行数。
RunExecuteScalar返回的是操作的结果值。

http://msdn.microsoft.com/zh-cn/library/e80y5yhx.aspx

好好看看吧