ASP to do Query Analyzer (Queries Analyzer) (V)

Source: Internet
Author: User
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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.