Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using LIKE in a DataSet
Message
De
08/01/2007 14:36:04
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Using LIKE in a DataSet
Divers
Thread ID:
01183540
Message ID:
01183540
Vues:
69
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform