Monday, December 17, 2007

How to add a column to a table

How to add a column to a table

S T E P - 1

- First, we need 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

- We can use a SQL command to add a column to a table:

oConn.Execute "ALTER TABLE Member " & _ ' Select which table you need to add column

"ADD (AccessLevel INTEGER);"

S T E P - 3

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

oConn.Close

Set oConn = Nothing

No comments: