Connection. asp

Source: Internet
Author: User

Today, I wrote some ASP object attributes and methods and pasted them ..
Connection. asp

< %
Response. Buffer
= True  
Dim Conn
Set Conn = Server. Createobject ( " ADODB. Connection " )
Conn. Open
" Provider = sqloledb.1; Data Source = (local); User ID = sa; Password =; initial catalog = pubs "  

' ----- Properties of the connection object -----
Response. Write ( CSTR (Conn. connectionstring) &   " <P> " )
Response. Write (
CSTR (Conn. connectiontimeout) &   " <P> " )
Response. Write (
CSTR (Conn. attributes) &   " <P> " )
Response. Write (
CSTR (Conn. defaultdatabase) &   " <P> " )
Response. Write (
CSTR (Conn. Mode) &   " <P> " )
Response. Write (
CSTR (Conn. State) &   " <P> " )
Response. Write (
CSTR (Conn. Version) &   " <P> " )

' ----- Method of the connection object -----
Dim RS
Set RS = Conn. Execute ( " Select * from authors " ,, 1 ) ' Adshorttext
Set RS = Conn. Execute ( " Authors " ,, 2 ) ' Adcmdtable
Set RS = Conn. Execute ( " Authors " ,, 512 ) ' Adcmdtabledirect
Set RS = Conn. Execute ( " Reptq1 " ,, 4 ) ' Adcmdstoredproc
Set RS = Conn. openschema ( 20 ) ' Adschematables

' ----- Test statement -----
Dim I
Response. Write (
" <Table> <tr> " )
For I = 0   To Rs. Fields. Count - 1
Response. Write (
" <TD> "   & RS (I). Name &   " </TD> " )
Next  
Response. Write (
" </Tr> " )
Do   While   Not Rs. EOF
Response. Write (
" <Tr> " )
For I = 0   To Rs. Fields. Count - 1
Response. Write (
" <TD> "   & RS (I) &   " </TD> " )
Next
Response. Write (
" </Tr> " )
Rs. movenext
Loop  
Rs. Close
Set RS = Nothing  
Conn. Close
Set Conn = Nothing  
%
>  

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.