"Andrew D. Newbould" <newsgroups@NOzadSPANsoft.com> wrote in message
news:KXCqYgF9FIODFwmW@zadsoft.gotadsl.co.uk...
> In message <u9ZX07rvFHA.708@TK2MSFTNGP10.phx.gbl>, Norman Yuan
> <NotReal@NotReal.not> writes
>>Not much difference from what you do in VB.
>>
>>Assume you want to open a ADO RecordSet in ASP (written in VBScript) to in
>>your Windows user logon/off script:
>>
>>Dim cn
>>Dim rs
>>
>>Set cn=CreateObject("ADODB.Connection)
>>cn.Open connectionString
>>
>>Set rs=CreateObject("ADODB.RecordSet")
>>rs.Open "SELECT * FROM theTable",cn
>>....
>>
>>rs.Close
>>cn.Close
>
> In ASP (using VBScript) change to:
>
> Set cn = Server.CreateObject("ADODB.Connection")
> Set rs = Server.CreateObject("ADODB.RecordSet")
>
> The "CreateObject" method is only available under the Server object in
> ASP. Everything else from then on; like accessing and updating the
> database; is the same assuming you are using MSDE, SQL Server or other
> server based database.
>
> On some servers you may need to specify the Connection object by using its
> Class-ID in order to specify the actual ADO version, but this is rare.
>
> If using an Access database you normally have to use the "Server.MapPath"
> command to enable the connection string to get the correct path to the
> database file (remember what you see from the server / ISP is not the REAL
> path to the database which the Access Driver MUST have). For example:
>
> strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
> Server.MapPath("./Data/MyAccessDBFile.mdb")
>
> --
> Andrew D. Newbould E-Mail: newsgroups@NOSPAMzadsoft.com
>
> ZAD Software Systems Web :
www.zadsoft.com