0
我有一个类型化数据集userProfile,它与我的数据库中的用户表相同。 我使用一个存储过程,而更改密码,当我使用这个程序的.cs代码SQL异常告诉数据集错误
[There is no row at position 0.]
in public UserRow this[int index] {
Line 413: get {
Line 414: return ((UserRow)(this.Rows[index]));
Line 415: }
Line 416: }
,但我在被更改密码返回相同user.But单排。 。
这是我的存储过程
ALTER proc [dbo].[sp_Campaign_PasswordChange]
@username varchar(50),
@old_password varchar(50),
@new_password varchar(50)
as
BEGIN TRY
BEGIN TRANSACTION
if exists(select "USER_ID" from "User" where [email protected] and [email protected]_password)
begin
select User_Id from "User" where [email protected]
update "User" set [email protected]_password where [email protected]
end
else
RAISERROR ('username or password does not exists',10,1)
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
RETURN @@ERROR
END CATCH
,但如果我写的select语句末尾,则不会产生错误
plz帮助
一个技巧,更喜欢使用'usp'为前缀的存储特效,而不是'sp'。 – 2010-09-12 12:10:44
@Jason - 好点,它实际上是导致问题的'sp_'。 SQL Server将首先在主数据库中查找这些数据。 – 2010-09-12 12:18:41