Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using LIKE in a DataSet
Message
From
08/01/2007 14:36:04
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Databases
Title:
Using LIKE in a DataSet
Miscellaneous
Thread ID:
01183540
Message ID:
01183540
Views:
68
The following SQL statement performs a LIKE on a field in my table and returns a DataSet. This statement works great. I can pass in part of the value such as 'myvar+%' or just pass '%' to get everything.
//This works.
string lc_sql = "SELECT * FROM mytable WHERE customer = 'XYZ' AND city LIKE '" + myvar + "'%"
My problem is that I can't get this to work when I create a .XSD DataSet and a table adapter. I create my SQL statement in the TableAdapter Query Configurator Wizard as follows.
SELECT *
FROM mytable
WHERE customer = @mycustvar AND city LIKE @mycityvar
When I call the above query, I pass in mycityvar as 'TOL%'. However, the only time a match is found is when I pass in the whole name such as 'TOLEDO%'.

How can I get a LIKE clause to work in a DataSet TableAdapter using the class designer?

Thanks,

Jerry
Next
Reply
Map
View

Click here to load this message in the networking platform