Query Analysis 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 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