I am trying to swap two rows in a table .. I am stuck with this error since a long time.. can anyone guess where the problem is ? create procedure was working fine in query analyzer but when used it in the stored procedure. I am getting these .. can anyone help me out please ... Your help will be greatly appreciated.. UpdateRowsReorderUp is my storedprocedure ... and i am using MS Sql 2000 .. am I doing something really wrong which i'm not supposed to ???
Thanks friends..
Procedure 'UpdateRowsReorderUp' expects parameter '@.nextlowestsortID', which was not supplied.
CREATE PROCEDURE [dbo].[UpdateRowsReorderUp]
(
@.intsortID int,
@.nextlowestsortID int,
@.MemberID int
)
AS
WHEN SortID = @.nextlowestsortID then @.intsortID
WHEN SortID = @.intsortID then @.nextlowestsortID ELSE SortID End
WHERE MemberID = @.MemberID
SELECT * FROM SelectedCredits WHERE MemberID= @.MemberID ORDER BY SortID
GO
**************
objcmd= new SqlCommand("UpdateRowsReorderUp",objConn);
objcmd.CommandType = CommandType.StoredProcedure;
objcmd.Parameters.Add("@.intsortID",intsortID);
objcmd.Parameters.Add("@.MemberID",Session["MemberID"]);
objRdr= objcmd.ExecuteReader();
dlSelCredits.DataSource = objRdr;
dlSelCredits.DataBind();
objRdr.Close();
objConn.Close();
BindData();
}
|||
Thanks for your reply . I'm storing a value in the @.nextlowestsortid using a SELECT statement.I am not assigning any value outside so that i can pass it into the parameter. for example @.intsortid i'm assiging intsortid through the code but what can i assign to this? Sorry to ask like this i am a newbie in this field..
Can i write the SELECT statement in different way so that there is no need add any parameter through the code ??
|||If the @.nextlowestsortid parameter is an internal parameter, remove itfrom the parameter list and declare it after the AS, like this:DECLARE @.nextlowestsortid int
Then you stored procedure will only have two parameters that you supply, and the error will go away.
Sam
|||
Thank you very much Sam .. I am really grateful to you ..
You solved my problem .. that was the perfect solution ..
cheers mate
No comments:
Post a Comment