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