日期:2013-06-07  浏览次数:21209 次

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="&strS