Monday, December 17, 2007

How to add a record to the table (Using SQL command)

How to add a record to the table (Using SQL command)

S T E P - 1

- We need to create a 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

- Use .Execute method to perform the SQL command.

Dim strSQL

strSQL = "Insert into member" & _

"(MemberID, Password, AccessLevel) " & _

"values('" & strMemberID & _

"','" & strPassword & _

"','" & strAccessLevel & "')"

oConn.Execute strSQL

No comments: