Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Using parameterized queries with ms access 2003 integration. To search any data according to different criteria.

share|improve this question
4  
Stack Overflow? – ephilip Dec 4 '09 at 13:27
I agree with ephilip, post this on SO and you'll get 5 answers in 2 minutes. ;) – Bobby Dec 4 '09 at 13:50
hey guys thanks for the reply but can you tell what SO is? – Nrew Dec 5 '09 at 0:26

migrated from superuser.com Dec 5 '09 at 6:24

2 Answers

You'll need to use the OleDbConnection class, as well as the OleDbCommand class, with the proper connection string for Access.

Dim sql as String = "SELECT * FROM TABLE_A WHERE COLUMN_A = @PARAM"
Dim connectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;"
Using connection As New OleDbConnection(connectionString)
   Dim command As New OleDbCommand(sql)
   command.Connection = connection
   command.Params.Add("@PARAM", yourVariable)
   connection.Open()
    Dim reader As OleDbDataReader = command.ExecuteReader()
    While reader.Read()
        Console.WriteLine(reader.GetString(1)
    End While
End Using
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.