View Single Post
  #3 (permalink)  
Old February 11th, 2007, 04:06 PM
anubisascends anubisascends is offline
Authorized User
Join Date: Aug 2006
Location: Charlotte, NC, USA.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubisascends

You can also try this:

Dim myCommand as new OledbCommand
Dim myConnection as new OledbConnection([Connection String])

myCommand.Connection = myConnection
myCommand.CommandText = [SQL string]

myCommand.[command type]

There are a few tricks to connecting to an Access Database. You need to know the connection string, you can locate the connection string at Older versions of Access use the Jet engine, which will need to be stated in the connection string, as nadhan_f showed in the con.Open line, while Access 07 uses a different engine.

The command text needs to show the sql string that you are going to execute (ie "Select * from sto_Employees")

The command type will tell the application what to run, some examples are:
ExecuteQuery - used for select queries
ExecuteNonQuery - used for insert, update and delete queries
ExecuteReader - used to run a data reader

What command type you use will depend on what you are trying to do.

Hope this helps.

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
Albert Einstein
US (German-born) physicist (1879 - 1955)
Reply With Quote