ASP create tables, copy table field types Appendix
Create a table in an existing database
<% set Conn=server. CreateObject ("Adodb.connection")
Sql= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &server. MapPath ("Book.mdb")
Conn.Open SQL
Conn.execute ("CREATE TABLE" BBB (ID autoincrement), p_id text (+), EE money,ff datetime default date (), GG guid,hh Single default 50,ii double,jj smallint,kk long,ll image,mm memo,oo yesno not null,pp tinyint,qq numeric (18,4), AA binary,b b bit,cc smallint,) ")
%>
' Another copy of Table a B (copy structure, no data)
<%
Set rs= Server.CreateObject ("ADODB. Recordset ")
Sql= "SELECT * to B from a where 1=0"
Rs.Open sql,conn,1,1
Rs.update
Rs.close
Set rs=nothing
%>
' Another copy of Table a B (including structure and data)
<%
Set rs= Server.CreateObject ("ADODB. Recordset ")
Sql= "SELECT * to B from a
Rs.Open sql,conn,1,1
Rs.update
Rs.close
Set rs=nothing
%>
12. Create a new database and create a new table
<%
' First create a database file
Set Conn=server.createobject ("Adox.catalog")
Conn.create "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data source=" &server.mappath ("Lifeda1.mdb")
%>
<%
' Create the appropriate table in this database
Set Rs=server.createobject ("Adox.table")
' The table name
Rs.name= "AAAA"
' This table field (field type See related appendix)
Rs.columns.append "id", 3
Rs.columns.append "Liuyan", 203
Rs.columns.append "DT", 7
Conn.tables.append RS
Set rs=nothing
%>
The form is now complete. Hope to be of help to you.
Field type Appendix
203 Notes
7th Issue/Time
1282 Binary
11 bool
6 currency
133 Date
134 Time
135 Date and time
5 Double Precision
4 Single Precision
3 numbers
2042 binary
202 string
ASP create tables, copy table field types Appendix