query parameter

  • Thread starter Thread starter dio
  • Start date Start date
D

dio

Hi there,

I'm trying to create an OleDBDataAdapter with a command that will receive a
parameter to act as a filter on the query.
I'm using the Query Builder wizard and it works fine, unless I define an
external parameter as the criteria, like '=@catID' (see the query please).
When I do it, I get the error "Data type error in expression"!
This is a sample of the query I'm trying to use:
----------------------------------
SELECT content.contentID, content.genID, content.ord, content.title,
users.username, users.userID, content.catID
FROM (content INNER JOIN
users ON content.userID = users.userID)
WHERE (content.catID = @catID)
ORDER BY content.ord DESC
 
dio said:
Hi there,

I'm trying to create an OleDBDataAdapter with a command that will receive a
parameter to act as a filter on the query.
I'm using the Query Builder wizard and it works fine, unless I define an
external parameter as the criteria, like '=@catID' (see the query please).
When I do it, I get the error "Data type error in expression"!
This is a sample of the query I'm trying to use:
----------------------------------
SELECT content.contentID, content.genID, content.ord, content.title,
users.username, users.userID, content.catID
FROM (content INNER JOIN
users ON content.userID = users.userID)
WHERE (content.catID = @catID)
ORDER BY content.ord DESC
----------------------------------

Does anyone have a clue why this happens? Thanx

dio


And where's the code that defines the OleDbParameter?
 
There's no need for code, I've figured it out.

To simplify things, my problem was with the query builder itself. I
tryed to create the previously stated query but, when I added the clause
'WHERE (content.catID = @catID)' and tryed to close the query builder
window, I got the error "Data type error in expression".

I thought the query builder tool didn't recognize the parameters format
in queries! I changed the '=@catID' to '=?' and it worked fine.

Hope I made it clear, thank you.
 
Back
Top