ASP operation access and the use of ADOX classes

Source: Internet
Author: User
Tags access database

General operation Access database, there are alter statements, and MSSQL2K basic syntax difference is not too dozen, for example, in a table to create a new column statement:

Dim sqlstr
sqlstr="alter table l_info add column info_file varchar(200)default NULL"
conn.execute(sqlstr)

The above statement creates column Info_file in L_info, for text type, length is 200, if there are no other settings, this time, the default:

Required field: No

Allow null character Fu Yi: No

This empty string can generally allow words not very satisfied, there is ADOX this space processing.

For more information please visit: Microsoft ADOX Introduction

This examples is a lot of surprising, can visit here to see all.

Here's one example: Many features can be implemented:

Sub Addhelpcolumn ()
Dim oconn, OCat, Ocolumn
' Open the Database
Set oconn = Server.CreateObject ("ADODB. Connection ")
oConn.Open mm_conn_string
' Open Table
Set OCat = Server.CreateObject ("ADOX. Catalog ")
Set ocat.activeconnection = oconn
' Create column
Set Ocolumn = Server.CreateObject ("ADOX. Column ")
With Ocolumn
Set. ParentCatalog = OCat ' must set before setting properties. Name = "Memhelp"
. Type = adLongVarWChar
. Properties ("Nullable") = True
. Properties ("Jet oledb:allow Zero Length") = True
End With
Ocat.tables ("Metaexternalfields"). Columns.Append Ocolumn
' Complete
Set Ocolumn = Nothing
Set OCat = Nothing
Oconn.close ()
Set oconn = Nothing
End Sub

The members of the collection column are:

Item property
Count property.
Delete method.
Refresh method.

For Column objects, see also: Column objects, not tables.

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.