Monday, December 17, 2007

How to perform a SQL command in the ADO Connection

How to perform a SQL command in the ADO Connection

S T E P - 1

- First, we need to create an ADO Connection.

Dim oConn

Set oConn = Server.CreateObject("ADODB.Connection")

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

S T E P - 2

- In the Connection object, it provides the Execute method to perform SQL command. For example:

oConn.Execute "DELETE * FROM Member"

S T E P - 3

- After using the connection, we will need to close it!

oConn.Close

Set oConn = Nothing

No comments: