ASP to manipulate the Access database program. Go

Source: Internet
Author: User
Tags date dsn integer access database
access| Program | data | Database <%
'---Define DSN names in array
'---Enter one or more DSN name in the database_list array
Database_list=array ("Test", "Test1")
'---enable deleting table? --carefull!!
Strenabledeletetable = False
'----End Declaration

'----do don't change code below this line---------------------------------------------
Field_value=array ("Integer", "Double", "char (255)", "Memo", "Date", "Currency", "Yesno")
Field_display=array ("Integer", "number", "Text", "Memo", "Date/time", "Currency", "yes/no")

Dsn_name = Request ("DatabaseName")
If Not dsn_name = "" Then
Set con = Server.CreateObject ("ADODB.") Connection ")
Con.provider = "SQLOLEDB"
If Dsn_name = "Test" Then
Constr = "Data Source =127.0.0.1;initial catalog=test; User id=test; password=1111 "
Else
Constr = "Data Source =127.0.0.1;initial catalog=test1; User Id=test1; password=1111 "
End If
Con. Open Constr
End If
table_name = Request ("tablename")

If Request ("addnewtable") <> "Then
If Request ("Newtablename") <> "Then
SQL = "CREATE TABLE" & Request ("Newtablename") & "(Fldauto Counter)"
Con. Execute (SQL)
End If
End If
If Request ("Addnewfield") <> "Then
If request ("NewFieldName") <> "Then
SQL = "ALTER TABLE" & table_name & "ADD" & Request ("NewFieldName") & "" & Request ("Newfieldtype") & "NULL"
Con. Execute (SQL)
End If
End If
If Request ("deletetable") <> "Then
SQL = "DROP TABLE" & Request ("tablename")
Con.execute (SQL)
End If
If Request ("DeleteColumn") <> "Then
For each item in Request ("Deletecol")
SQL = "ALTER TABLE" & Request ("tablename") & "DROP" & Item
Con. Execute (SQL)
Next
End If
'-----file name--------------------------------------------------------
File = Request.ServerVariables ("Script_name")
File = StrReverse (file)
pos = Instr (file, "/")
File = Left (file, pos-1)
File = StrReverse (file)
%>

<%
Response.Write "<! DOCTYPE HTML PUBLIC ""-//w3c//dtd HTML 3.2 final//en ">"
Response.Write "Response.Write "<body bgcolor=" "#FFFFFF" "><br><br><center>"

'------------------------------------------------------------
Response.Write "<form action=" "" & File & "" Method=post> "
Response.Write "<b><font Face=verdana size=3 color=" "#008080" "><u>total Database control</u> </font></b><br><br> "
Response.Write "<font face=verdana,arial size=2><b>database Name: </b></font>"
Response.Write "<select name=" "DatabaseName" ">"
For i = 0 to UBound (database_list)
If database_list (i) = Request ("DatabaseName") Then
Response.Write "<option value=" "" & Database_list (i) & "" Selected> "& Database_list (i)
Else
Response.Write "<option value=" "" & Database_list (i) & "" > "& Database_list (i)
End If
Next
Response.Write "</select>"
Response.Write "<input Type=submit Name=godata



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.