K
Kenneth Baltrinic
I am calling a query stored in Access that requires a parameter. But the
parameter that I am passing in as part of the command does not seem to be
being recognized.
I have two queries in an Access database. They are:
SELECT [tblEventParticipants].[EventID], [tblEventParticipants].[MemberID],
[tblEventParticipants].[InterestLevelID]
FROM tblEventParticipants
WHERE ((([tblEventParticipants].[MemberID])=[CurrentMemberID]));
And
SELECT qryEventListData.*, qryCurrentMemberParticipation.MemberID,
IIf([DisplayText] Is Null,"Not Interested",[DisplayText]) AS MemberInterest,
IIf([qryCurrentMemberParticipation]![InterestLevelID] Is
Null,0,[qryCurrentMemberParticipation]![InterestLevelID]) AS
MemberInterestLevel
FROM tblInterestLevels RIGHT JOIN (qryEventListData LEFT JOIN
qryCurrentMemberParticipation ON qryEventListData.EventID =
qryCurrentMemberParticipation.EventID) ON tblInterestLevels.InterestLevelID
= qryCurrentMemberParticipation.InterestLevelID;
The important part of the above is:
1) I am calling the second query using an OdbcCommand.GetReader() call.
2) The second query includes uses the first.
3) The first query contains a parameter (CurrentMemberID)
The problem is that I call the query using the following code and get the
following error:
string sQuery =
"SELECT * FROM qryEventListDataWithParticipation";
OdbcCommand cmdGetEvents = new OdbcCommand(sQuery,
EventDataWrapper.Connection);
OdbcParameter oMemberID =
cmdGetEvents.Parameters.Add("CurrentMemberID", OdbcType.Int, 4);
oMemberID.Value = miCurrentMemberID;
OdbcDataReader dr = cmdGetEvents.ExecuteReader();
ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 1.
Can anyone explain why the parameter that I am creating is not being
recognized? For what it is worth, I have attempted calling the first query
directly just to test, but that resulted in the same error.
parameter that I am passing in as part of the command does not seem to be
being recognized.
I have two queries in an Access database. They are:
SELECT [tblEventParticipants].[EventID], [tblEventParticipants].[MemberID],
[tblEventParticipants].[InterestLevelID]
FROM tblEventParticipants
WHERE ((([tblEventParticipants].[MemberID])=[CurrentMemberID]));
And
SELECT qryEventListData.*, qryCurrentMemberParticipation.MemberID,
IIf([DisplayText] Is Null,"Not Interested",[DisplayText]) AS MemberInterest,
IIf([qryCurrentMemberParticipation]![InterestLevelID] Is
Null,0,[qryCurrentMemberParticipation]![InterestLevelID]) AS
MemberInterestLevel
FROM tblInterestLevels RIGHT JOIN (qryEventListData LEFT JOIN
qryCurrentMemberParticipation ON qryEventListData.EventID =
qryCurrentMemberParticipation.EventID) ON tblInterestLevels.InterestLevelID
= qryCurrentMemberParticipation.InterestLevelID;
The important part of the above is:
1) I am calling the second query using an OdbcCommand.GetReader() call.
2) The second query includes uses the first.
3) The first query contains a parameter (CurrentMemberID)
The problem is that I call the query using the following code and get the
following error:
string sQuery =
"SELECT * FROM qryEventListDataWithParticipation";
OdbcCommand cmdGetEvents = new OdbcCommand(sQuery,
EventDataWrapper.Connection);
OdbcParameter oMemberID =
cmdGetEvents.Parameters.Add("CurrentMemberID", OdbcType.Int, 4);
oMemberID.Value = miCurrentMemberID;
OdbcDataReader dr = cmdGetEvents.ExecuteReader();
ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 1.
Can anyone explain why the parameter that I am creating is not being
recognized? For what it is worth, I have attempted calling the first query
directly just to test, but that resulted in the same error.