I'm writing an ASP.NET(C#) application in Visual Studio 2008 and connecting to SQLExpress 2005.
While trying to update a FormView control bound to an SqlDataSource by using a parameterized stored procedure, I constantly get an error screen saying "too many arguments specified".
I have tried clearing the list and adding all the parameters manually before calling the DataSource.Update() method. I have tested with a breakpoint and immediately before the Update method fires, the UpdateParameters collection holds the 8 arguments I have specified in my stored procedure so I know my collection conforms to what I asked for.
Passing in update commands of type="text" that contain an EXEC statement will work but I need it to work by calling the procedure itself.
Has anyone else run into these "extra arguments" or am I playing EPR and chasing imaginary variables?
CREATE PROC spUpdateUserProfile
@UserNameVar nvarchar(256),
@DisplayNameVar varchar(30),
@FNameVar varchar(20),
@LNameVar varchar(20),
@EmailVar varchar(30)=NULL,
@LocationVar varchar(100)=NULL,
@BirthdateVar smalldatetime=NULL,
@BiographyVar varchar(2000)=NULL
AS
UPDATE UserProfile
SET UserDisplayName = @DisplayNameVar,
UserFName = @FNameVar,
UserLName = @LNameVar,
UserSharedEmail = @EmailVar,
UserLocation = @LocationVar,
UserDOB = @BirthdateVar,
UserBiography = @BiographyVar
WHERE UserProfile.UserID =
(SELECT UserProfile.UserID FROM UserProfile
JOIN aspnet_Users ON UserProfile.UserID = aspnet_Users.UserId
WHERE aspnet_Users.UserName = @UserNameVar)