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

來源:互聯網
上載者:User
查詢分析 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('"&strTable&"'),'"&strColumn&"','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 ="<NULL>"
                    Elseif trim(strFieldValue)="" then
                        strFieldValue="<BLANK>"
                    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="&strServer&";" & _
                "Initial Catalog=" & xdbname & _
                ";UID=" & xuserid & ";PWD=" & xpassword & ";"
        
  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
  



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.