Query builder parameter problem

  • Thread starter Thread starter Jay Bryan
  • Start date Start date
J

Jay Bryan

Using VS2005 Pro and dotnet 2.0

I am trying to add parameters in the query builder tool while configuring my
data adapter using the data adapter configuration wizard. I right-click
somewhere on the builder pane and then select properties. At the bottom of
the properties window, there is a line that says 'Query Parameter
Identification'. I click the ellipses to the right and I have three items to
change - Prefix characters, Suffix characters, Escape characters. I put a
Prefix character in the box (In this case I have tried the @ and % symbols),
click ok and close the properties box. So far so good.

Then in the filter column for the row I want to filter, I put the parameter
name I want - in this case @UserID. The builder puts an '=' sign in front.
Again, everything is fine.

I click the Execute query button at the bottom left and the builder asks me
for the parameter data. I input '222' and click ok. I get the results I was
expecting. Great! But now the problem starts.

I click Ok to exit the builder then click next on the data adapter
configuration wizard. I get the following error:

Generated Select statement
Error in WHERE clause near '@'
Unable to parse query text.

When I click finish, I get a message box saying "An unexpected error has
occurred. Error Message: Object reference not set to an instance of an
object."

I can't seem to get it to accept my parameters even though when I execute
the query within the builder, everything works as expected. Has anyone had
this same problem or can you recreate it?

Thanks,
Jay
 
Dig into the generated code and see what the CommandText is for the
SelectCommand associated with the DataAdapter. Send it here and we'll take a
look.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top