ASP做查询分析器(Query Analyzer)(V)

2009-12-31 12:18:38 作者:权威 来源:官方www1098t.com编程网 浏览次数:0 网友评论 0



            

            DataTypeLib.ASP

 

                  

                  

        











DataTypeLib.ASP

<%
Function selectIdentity(strConnect,strTable,strColumn)
Dim objConn, objRS, strFieldName, strFieldType, arrData, intRowCounter, intColCounter, strFieldValue
Dim intUBoundRow, intUBoundCol, strSQLID Set objConn=Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = strConnect
objConn.Open
strSQLID = "SELECT COLUMNPROPERTY( OBJECT_ID('"%26strTable%26%26quot;'),'"%26strColumn%26%26quot;','IsIdentity')"
Set objRS = objConn.Execute(strSQLID)
????????If objRS.EOF and objRS.BOF then
????????????Response.Write("No records matched or table is empty")
????????????objRS.Close
????????????Set objRS = Nothing
????????????objconn.Close
????????????Set objconn=Nothing
????????Else
????????????' Now lets grab all the records and close objects
????????????arrData=objRS.Getrows
????????????objRS.Close
????????????Set objRS = Nothing
????????????objConn.Close
????????????Set objConn = Nothing
????????????
????????????intUBoundRow = UBound(arrData,2)
????????????intUBoundCol = UBound(arrData,1)
????????????For intRowCounter = 0 to intUBoundRow
????????????????For intColCounter = 0 to intUBoundCol
????????????????????strFieldValue = arrdata(intcolcounter,introwcounter)
????????????????????If isNull(strFieldValue) then
????????????????????????strFieldValue =""
????????????????????Elseif trim(strFieldValue)="" then
????????????????????????strFieldValue=""
????????????????????End if
????????????????Next
????????????Next
????????End if
????selectIdentity = strFieldValue
End Function


Sub getIdentity(strServer, xdbname, xuserid, xpassword)

dim cnn, cat, tbl, fld, strCookieIdentity
dim connectstring
??connectstring = _
????????????????"Provider=SQLOLEDB.1;Data Source="%26strServer%26%26quot;;" %26 _
???????????????"Initial Catalog=" %26 xdbname %26 _
???????????????";UID=" %26 xuserid %26 %26quot;;PWD=" %26 xpassword %26 %26quot;;"
????????
??set cnn = server.createobject("adodb.connection")
??set cat = server.createobject("adox.catalog")
??set tbl = server.createobject("adox.table")
??set fld = server.createobject("adox.column")
??
??cnn.Open connectstring
??
??cat.ActiveConnection = cnn
??????For Each tbl In cat.Tables
??????
????????If tbl.Type = "TABLE" Then
????????????For Each fld In tbl.columns
????????????????If selectIdentity(connectstring,tbl.name,fld.name) = 1 Then
???????????????????strCookieIdentity = strCookieIdentity %26 tbl.name %26 fld.name
???????????????End If
????????????Next??
????????End If
????????
??????Next

????set cat = nothing
????set tbl = nothing
????cnn.Close
????set cnn = nothing
????response.cookies(xdbname %26 %26quot;strCookieIdentity") = strCookieIdentity %26 xdbname
end sub ???


Function getType(strFieldTypeNumber)

Dim strFieldType

Select Case strFieldTypeNumber

????????Case 0x2000
???????????????strFieldType = "adArray"
????????Case 20
????????????strFieldType = "adBigInt"????????
????????Case 128
????????????strFieldType = "adBinary"
????????Case 11
????????????strFieldType = "adBoolean"
????????Case 8
????????????strFieldType = "adBSTR"
????????Case 136
????????????strFieldType = "adChapter"
????????Case 129
????????????strFieldType = "adChar"
????????Case 6
????????????strFieldType = "adCurrency"
????????Case 7
????????????strFieldType = "adDate"
????????Case 133
????????????strFieldType = "adDBDate"
????????Case 137
????????????strFieldType =?????"adDBFileTime"
????????Case 134
????????????strFieldType =?????"adDBTime"
????????Case 135
????????????strFieldType = "adDBTimeStamp"
????????Case 14
????????????strFieldType = "adDecimal"
????????Case 5
????????????strFieldType = "adDouble"
????????Case 0
????????????strFieldType = "adEmpty"
????????Case 10????
????????????strFieldType = "adError"
????????Case 64
????????????strFieldType =?????"adFileTime"
????????Case 72
????????????strFieldType = "adGUID"
????????Case 9
????????????strFieldType = "adIDispatch"
????????Case 3
????????????strFieldType = "adInteger"
????????Case 13
????????????strFieldType = "adIUnknown"
????????Case 205????
????????????strFieldType = "adLongVarBinary"
????????Case 201
????????????strFieldType = "adLongVarChar"
????????Case 203
????????????strFieldType = "adLongVarWChar"
????????Case 131
????????????strFieldType = "adNumeric"
????????Case 138
????????????strFieldType = "adPropVariant"
????????Case 4
????????????strFieldType = "adSingle"
????????Case 2
????????????strFieldType = "adSmallInt"
????????Case 16
????????????strFieldType = "adTinyInt"
????????Case 21
????????????strFieldType = "adUnsignedBigInt"
????????Case 19
????????????strFieldType = "adUnsignedInt"
????????Case 18
????????????strFieldType =????"adUnsignedSmallInt"
????????Case 17
????????????strFieldType =????"adUnsignedTinyInt"
????????Case 132
????????????strFieldType =????"adUserDefined"
????????Case 204
????????????strFieldType =????"adVarBinary"
????????Case 200
????????????strFieldType =????"adVarChar"
????????Case 12
????????????strFieldType =????"adVariant"
????????Case 139
????????????strFieldType =????"adVarNumeric"
????????Case 202
????????????strFieldType =????"adVarWChar"
????????Case 130????
????????????strFieldType =????"adWChar"
????????Case Else
??????????????strFieldType = "Unknown Data Type"
????????????
????End Select

???getType = strFieldType
End Function
%>
ASP做查询分析器(Query Analyzer)(V)是www1098t.com的会员在技术文章最新发表的,同时也欢迎你就ASP做查询分析器(Query Analyzer)(V)提问.欢迎来到我们的服务器编程网站查询分析器的文章.
关键词:分析器

相关文章

[错误报告] [推荐] [收藏] [打印] [关闭] [返回顶部]

  • 验证码:

最新图片文章

最新文章