Hi, I've read a bit in this forum, and it looks like a great resource! Here's a question that someone asked before, but I think my answer may be different:
My client uses only Access databases (I know, I know) and I'm getting this error.
System.Data.OleDb.OleDbException: Too few parameters. Expected 5.
Here's the vb code:
Public Overrides Function SwitchProjectUserID(ByVal userId, ByVal SwitchUserId) As Integer ' validate input If userId Is Nothing Then Throw New ArgumentNullException("UserID") End If If userId <= 0 Then Throw New ArgumentOutOfRangeException("UserID") End If ' Execute SQL Command Dim sqlCmd As New OleDbCommand AddParamToSQLCmd(sqlCmd, "@UserId", OleDbType.Integer, 0, ParameterDirection.Input, userId ) AddParamToSQLCmd(sqlCmd, "@SwitchUserId", OleDbType.Integer, 0, ParameterDirection.Input, SwitchUserId) SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_USER_SWITCHPROJECTUSERID) ExecuteScalarCmd(sqlCmd) Return True End Function
Here's the "query" in the access database (which came with the IssueTracker starter kit from asp.net)
UPDATE IssueTracker_ProjectMembers, IssueTracker_Projects SET UserID = [@SwitchUserID], IssueTracker_Projects.ProjectCreator = [@SwitchUserID], IssueTracker_Projects.ProjectManager = [@SwitchUserID] WHERE UserId=[@UserId] And [IssueTracker_Users].[UserDisabled]=0;
Someone elsewhere in these forums mentioned Access getting confused by "too many brackets". I presume in the procedure. I removed those brackets, but they come back as soon as I close the Access database. (this isn't a procedure in my vb code, but a "query" in the access DB).
Can anyone help?