Create a table in the Access Database Using ASP
Method 1
Bytes ----------------------------------------------------------------------------------------
Rep4 is the name of the created table. Not null does not need to be explicitly defined. It is a non-mandatory field by default.
<! -- # Include file = "conn. asp" -->
<%
Set rs = Createobject ("ADODB. recordset ")
SQL = "CREATE TABLE rep4 (ID counter, caption char (30), keyword char (20), source char (30), infotype char (20), dateandtime date, content memo)"
Rs. Open SQL, Conn, 1, 3
%>
Create index [index name] on [Table name] ([field name] DESC) with disallow null
No string type
Cannot use [] should use ()
Create Table newid
(
Id counter,
Caption text (30) not null,
Keyword text (20) not null,
Source Text (20 ),
Dateandtime datetime,
Content memo
)
I passed this section
Method 2
Bytes ----------------------------------------------------------------------------------------
In some cases, you need to create a table in the ACCESS database. You do not have to change the database and upload it again. Here is a simple introduction.
<%
''First create a database file
Set conn = server. Createobject ("ADOX. catalog ")
Conn. Create "provider = Microsoft. Jet. oledb.4.0;" & "Data Source =" & server. mappath ("database name. mdb ")
%>
<%
''Create a table for the database
Set rs = server. Createobject ("ADOX. Table ")
''Name of the table
Rs. Name = "adminis1"
''This table field (for field types, see the relevant appendix)
Rs. Column. APPEND "liuyan", 203
Rs. Columns. APPEND "DT", 7
Conn. Tables. append rs
Set rs = nothing
%>
Now, the table is created. Hope to help you.
Field Type Appendix
203 remarks
7. date/time
Binary 128
11 Boolean
6 currencies
Date 133
Time 134
135 Date and Time
5. Double Precision
4. single precision
Binary 204
202 string