admin
05-29-2003, 03:21 PM
Adding a New Table to an Access Database with SQL:
<%
SQL = "CREATE tblCustomer (FirstName text, LastName text, Age number)"
SET Conn = Server.CreateObject("ADODB.Connection")
Conn.Open yourDSN
SET Rec = Server.CreateObject("ADODB.COMMAND")
Rec.ActiveConnection = Conn
Rec.CommandText = SQL
Rec.EXECUTE
SET Rec = NOTHING
SET Conn = NOTHING
%>
This creates a new table named tblCustomer with the fields FirstName and LastName as text, and the field Age as number.
<%
SQL = "CREATE tblCustomer (FirstName text, LastName text, Age number)"
SET Conn = Server.CreateObject("ADODB.Connection")
Conn.Open yourDSN
SET Rec = Server.CreateObject("ADODB.COMMAND")
Rec.ActiveConnection = Conn
Rec.CommandText = SQL
Rec.EXECUTE
SET Rec = NOTHING
SET Conn = NOTHING
%>
This creates a new table named tblCustomer with the fields FirstName and LastName as text, and the field Age as number.