Create a table in the Access Database Using ASP

Source: Internet
Author: User
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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.