ASP create tables, Copy table field type Appendix _ Application Tips
Source: Internet
Author: User
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 (1,1), p_id text (MB), 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,) ")
%>
' Copy a table to a B table (copy structure only, no data included)
<%
Set rs= Server.CreateObject ("ADODB.") Recordset ")
Sql= "SELECT * into B" where 1=0 "
Rs.Open sql,conn,1,1
Rs.update
Rs.close
Set rs=nothing
%>
' Copy a table to another B table (including structure and data)
<%
Set rs= Server.CreateObject ("ADODB.") Recordset ")
Sql= "SELECT * into B"
Rs.Open sql,conn,1,1
Rs.update
Rs.close
Set rs=nothing
%>
12. Create a new database and create a new table
<%
' first set up 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 table in the database
Set Rs=server.createobject ("Adox.table")
' The form name
Rs.name= "AAAA"
' The table field (see Related Appendix for field type)
Rs.columns.append "id", 3
Rs.columns.append "Liuyan", 203
Rs.columns.append "DT", 7
Conn.tables.append RS
Set rs=nothing
%>
At this point, the form is complete. Hope to be helpful to you.
Field type Appendix
203 Notes
Date of 7th/time
1282 in-system
11 Boolean
6 currency
133 Date
134 Times
135 Date and time
5 Double Precision
4 Single Precision
3 numbers
2042 in-system
202 string
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.