Connection.asp

今天把一些ASP对象的属性和方法写了一遍,贴一下。。
Connection.asp

None.gif <
None.gifResponse.Buffer
= true  
None.gif
Dim  conn 
None.gif
Set  conn = Server. CreateObject ( " ADODB.Connection "
None.gifconn.Open 
" Provider=SQLOleDb.1;Data Source=(local);User ID=sa;Password=;Initial Catalog=Pubs "  
None.gif
None.gif
' -----Connection 对象的属性----- 
None.gif
Response.Write( CStr (conn.ConnectionString)  &   " <p> "
None.gifResponse.Write(
CStr (conn.ConnectionTimeout)  &   " <p> "
None.gifResponse.Write(
CStr (conn.Attributes)  &   " <p> "
None.gifResponse.Write(
CStr (conn.DefaultDataBase)  &   " <p> "
None.gifResponse.Write(
CStr (conn.Mode)  &   " <p> "
None.gifResponse.Write(
CStr (conn.State)  &   " <p> "
None.gifResponse.Write(
CStr (conn.Version)  &   " <p> "
None.gif
None.gif
' -----Connection 对象的方法----- 
None.gif
Dim  rs 
None.gif
Set  rs = Conn. Execute ( " SELECT * FROM authors " ,, 1 ' adCmdText 
None.gif
Set  rs = Conn. Execute ( " authors " ,, 2 ' adCmdTable 
None.gif
Set  rs = Conn. Execute ( " authors " ,, 512 ' adCmdTableDirect 
None.gif
Set  rs = Conn. Execute ( " reptq1 " ,, 4 ' adCmdStoredProc 
None.gif
Set  rs = Conn.OpenSchema( 20 ' adSchemaTables 
None.gif

None.gif
' -----测试语句----- 
None.gif
Dim  i 
None.gifResponse.Write(
" <table><tr> "
None.gif
For  i = 0   To  rs.Fields.Count - 1   
None.gif    Response.Write(
" <td> "   &  rs(i).Name  &   " </td> "
None.gif
Next  
None.gifResponse.Write(
" </tr> "
None.gif
Do   While   NOT  rs.EOF  
None.gif    Response.Write(
" <tr> " )  
None.gif    
For  i = 0   To  rs.Fields.Count - 1   
None.gif        Response.Write(
" <td> "   &  rs(i)  &   " </td> " )  
None.gif    
Next   
None.gif    Response.Write(
" </tr> " )  
None.gif    rs.MoveNext 
None.gif
Loop  
None.gifrs.Close 
None.gif
Set  rs = Nothing  
None.gifconn.Close 
None.gif
Set  conn = Nothing  
None.gif%
>  
None.gif

转载于:https://www.cnblogs.com/wddavid/archive/2005/05/15/155614.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值