SQL query not working
Posted
by Ziv
on Stack Overflow
See other posts from Stack Overflow
or by Ziv
Published on 2010-06-13T16:31:56Z
Indexed on
2010/06/13
16:42 UTC
Read the original article
Hit count: 166
hi, I'm trying to create a query in an access database for a C# dataset using the query editor but the created method says there is a problem and isn't created correctly.
SELECT Discs.*
FROM Discs
WHERE (Title=@Title OR @Title IS NULL) AND
(Type=@Type OR @Type IS NULL) AND
(ContainerID=@ContainerID OR @ContainerID IS NULL) AND
NOT (@Title IS NULL AND @Type IS NULL AND @ContainerID IS NULL)
the error is:
Generated SELECT statement.
Error in WHERE clause near '@'.
Unable to parse query text.
the generated select method doesn't have any parameters and is unusable. I've tried the exact same SQL statement in the access query and it worked flawlessly, what am I supposed to be doing differently when transferring it to C#?
© Stack Overflow or respective owner