1

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

2
  • I agree with ephilip, post this on SO and you'll get 5 answers in 2 minutes. ;) Commented Dec 4, 2009 at 13:50
  • hey guys thanks for the reply but can you tell what SO is? Commented Dec 5, 2009 at 0:26

2 Answers 2

3

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
Sign up to request clarification or add additional context in comments.

Comments

0

You may find this helpful: Howto? Parameters and LIKE statement SQL

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.