Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem w/parameterized sql stmt
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00661706
Message ID:
00661918
Vues:
21
>HI Mike,
>
>>SELECT HINIT,HNAME FROM HWHOA WHERE (HINIT = @hinit)
>
>From "Parameters in Data Adaptor Commands" in the doc, my understanding is that named parameters (@hinit) are only used with the sqldataadapter and that the placeholder (?) is only used with the oledbdataadapter. Im using the latter.
>
>The querybuilder actually would not let me enter a named parameter. At any rate, I added "Hinit" to the parameter collection of my oledbdataadapter and it seemed accept the place holder.
>
>No errors when I run the form but still not getting anything in the data set. Have to keep playing.
>
>Thanks for your help!
>
>Todd

Yes you are right, use the ? with oledbdataadapter (Humm, there are still data sources other that SQL server in use <s>).

SELECT HINIT,HNAME FROM HWHOA WHERE (HINIT = ?)

You should still get the parameter(s) generated by the wizard. To check go to oledbdataadapter properties, selectcommand, parameters collection. You should see the created parameter list. To test go to oledbdataadapter properties and select preview data. Add in the desired parameter values and hit Fill Dataset. You should get the data returned (At least it works for me).
Michael McLain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform