Forum Moderators: open

Message Too Old, No Replies

basic database connection problem

         

ivorvanrensburg

6:07 pm on Jun 9, 2005 (gmt 0)



I'm new to asp and have just been going through tutorials on ADO connections to a database but i can't seem to get this right. i keep getting an error code saying "Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'open'
/asp_learning/dbs_connections/TMPccurhtwy7.asp, line 21"

now my question is why doesn't it support open?

heres the code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<!--#include virtual="/adovbs.inc"-->
<%
'open up a connection to Access database, we'll use DSN-less connection
Dim objConn
'set objConn = Server.CreateObject("ADODB.Connection")
'objConn.ConnectionString "DSN=test.dsn"

set objConn = server.createobject("ADODB.Connection")
objConn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\dbs\test.mdb"

'create a recordset object instance and retrieve the info from the adrresses table
Dim objRS
objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "website", objConn, , , adCmdTable

'display the contents of the url table
Do while Not objRS.EOF
Response.Write "<B>" & objRS ("Name") & "</b><br>"
response.Write objRS("url") & "<br>"

'move to next row in table
obj.MoveNext
Loop

'clean up ADO objects
objRS.Close
set objRS = Nothing

objConn.Close
set objConn = nothing
%>

aspdaddy

1:32 pm on Jun 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use SET keyword when creating the recordset
SET objRS = Server.CreateObject("ADODB.Recordset")

djscratch

11:02 am on Jun 13, 2005 (gmt 0)

10+ Year Member



here's a great site for asp help especially with database connections

[aspfaq.com...]

[aspfaq.com...]