Friday, December 14, 2007

How to create a Table by using ADO Connection and SQL commands?

How to create a Table by using ADO Connection and SQL commands?

After we have connected to the database, we can start using it now!

We can use the "Execute" method in the ADO connection to create a table in the database:

<%

Set conn = Server.CreateObject("Adodb.Connection")

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

conn.execute "CREATE TABLE Login (userid Text(10), passwd Text(10))"

' CREATE TABLE

' ( [Field Name] {Fields Type} )

%>

No comments: