How to use parameterized queries in vb.net?

775 views Asked by At

How to use parameterized queries in vb.net? Because I always wanted to make a program that could read an ms access database and display results based on your query.

1

There are 1 answers

0
Rob Gray On BEST ANSWER

Create the desired query using question marks in the place of your parameters

Dim sql = "SELECT * FROM Students WHERE Name = ?"

Then create a OleDbCommand object and set the appropriate values (CommandText and so on). Then add Parameters to the command object. Finally, execute it how you need. Eg as ExecuteReader.