query parameter

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
 
R

Rutger Smit

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?
 
D

dio

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top