Author: Tonny
Reprint please show the Source: http://www.weiw.com
Database structure operations. Adapts to common databases such as Access,sql server.
1. Establish a connection.
Can be connected through ODBC or OLE DB.
Set GOBJDC = Server.CreateObject ("ADODB. Connection ")
Dim strconn,mydsn
mydsn= "Test"
Strconn= "dsn=" &myDSN& "uid=sa;pwd="
' strconn = ' provider=sqloledb.1; Persist Security info=true; User id=sa;initial catalog=meisha;data Source=tonny "
Gobjdc.connectionstring=strconn
Gobjdc.open
2. Show All Tables
Set Gobjrs = Gobjdc.openschema (adSchemaTables)
Do as not gobjrs.eof
If gobjrs.fields ("table_type") = "TABLE" and Left (Gobjrs.fields ("table_name"), 4) <> "Msys" Then
' You don't have to show the system table.
Response.Write "<TR>"
Response.Write "<TD>" & Gobjrs.fields ("table_name") & "</TD>"
Myplink = "? Dsn_name= "& MyDSN &" &table_name= "& Gobjrs.fields (" table_name ")
Response.Write "<TD> <a href=tablestruct.asp" & Myplink & ">Structure</A> </TD>"
Response.Write "<TD> <a href=tablecontent.asp" & Myplink & ">Content</A> </TD>"
Response.Write "</TR>" & VbCrLf
End If
Gobjrs.movenext
Loop
Gobjrs.close
3. Create a new table
<form method=post action= "definetable.asp? dsn_name=<% =mydsn%> ">
Table Name:<br>
<input type= "text" name= "table_name" ><BR>
Field Count:<br>
<input type= "text" name= "Field_count" ><BR>
<BR>
<input type= "Submit" value= "Create" >
</FORM>
Main source of Definetable.asp
Myfieldcount = Request.Form ("Field_count")
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.