If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > What's wrong with this script?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-04, 19:54
davep23 davep23 is offline
Registered User
 
Join Date: Dec 2003
Location: Brisbane
Posts: 14
What's wrong with this script?

Could anyone look over this code and see what might be the problem?

I am trying to use this script in an .asp page so that it will access data from a database and write it on the page... but all I get are error messages...

I'm using SunOne asp and an access database called: database1.mdb

###################################
<% @ Language="VBScript" %>
<% Option Explicit %>
<%
Dim PeopleRS, sConnString, myConn, mySQL
Set myConn= server.CreateObject("ADODB.Connection")
sConnString="DSN=database1"
myConn.Open sConnString
mySQL = "Select * from People"
Set PeopleRS = myConn.Execute(mySQL)
Response.Write "<table>"
do while not PeopleRS
Response.Write "<tr>"
Response.Write "<td>" & PeopleRS("ID").value & "</td>"
Response.Write "<td>" & PeopleRS("People").value & "</td>"
Response.Write "<td>" & PeopleRS("Comment").value & "</td>"
Response.Write "</tr>"
PeopleRS.MoveNext
loop
Response.Write "</table>"
Set PeopleRS = nothing
Set myConn = nothing
%>
###################################
Reply With Quote
  #2 (permalink)  
Old 01-25-04, 21:42
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Post the error message you got.
Reply With Quote
  #3 (permalink)  
Old 01-25-04, 21:55
davep23 davep23 is offline
Registered User
 
Join Date: Dec 2003
Location: Brisbane
Posts: 14
error message

The error message is thus:

Error Type:
ADODB.Connection.1 (0x80004005)
SQLState: S1000 Native Error Code: -1045 [DataDirect][ODBC SequeLink driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Not a valid bookmark.



Quote:
Originally posted by gyuan
Post the error message you got.
Reply With Quote
  #4 (permalink)  
Old 01-25-04, 22:06
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Did you test your ODBC connection?
Reply With Quote
  #5 (permalink)  
Old 01-25-04, 22:15
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Try this:

sConnString = "DRIVER={Microsoft Access Driver(*.mdb)};"
sConnString = sConnString & "DBQ=..\..\....\Database.mdb"
Reply With Quote
  #6 (permalink)  
Old 01-25-04, 22:21
davep23 davep23 is offline
Registered User
 
Join Date: Dec 2003
Location: Brisbane
Posts: 14
DSN less Only

My server host will only support DSN less. It will not support DSN path access.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On