最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
数据库结构操作
时间:2022-06-30 10:13:39 编辑:袖梨 来源:一聚教程网
作者:tonny
转载请显示出处:http://www.weiw.com
数据库结构操作。适应于access,sql server等常见的数据库。
1。建立连接。
可以通过ODBC或OLEDB连接。
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。显示所有表
set gObjRS = gObjDC.OpenSchema(adSchemaTables)
Do While Not gObjRS.EOF
If gObjRS.Fields("TABLE_TYPE") = "TABLE" AND Left(gObjRS.Fields("TABLE_NAME"), 4) <> "MSys" Then
'不必把系统表显示出来
Response.Write ""
Response.Write "" & gObjRS.Fields("TABLE_NAME") & " "
myPLink = "?DSN_NAME=" & myDSN & "&Table_Name=" & gObjRS.Fields("TABLE_NAME")
Response.Write " Structure "
Response.Write " Content "
Response.Write " " & vbCrLf
End If
gObjRS.MoveNext
Loop
gObjRS.Close
3。新建表
definetable.asp中主要源码
myFieldCount = Request.Form("Field_Count")
转载请显示出处:http://www.weiw.com
数据库结构操作。适应于access,sql server等常见的数据库。
1。建立连接。
可以通过ODBC或OLEDB连接。
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。显示所有表
set gObjRS = gObjDC.OpenSchema(adSchemaTables)
Do While Not gObjRS.EOF
If gObjRS.Fields("TABLE_TYPE") = "TABLE" AND Left(gObjRS.Fields("TABLE_NAME"), 4) <> "MSys" Then
'不必把系统表显示出来
Response.Write "
Response.Write "
myPLink = "?DSN_NAME=" & myDSN & "&Table_Name=" & gObjRS.Fields("TABLE_NAME")
Response.Write "
Response.Write "
Response.Write "
End If
gObjRS.MoveNext
Loop
gObjRS.Close
3。新建表
definetable.asp中主要源码
myFieldCount = Request.Form("Field_Count")