[thelist] help: Object required

Dena teke at pullman.com
Wed May 25 12:44:51 CDT 2005

The problem was variable definition.  This code works:

<% Option Explicit %>
<% response.buffer=TRUE %><%

dim Path, Connection, dbConn

sub subOpenDBConn()
		Path = Server.MapPath ("/datastore/library.mdb")
  	Set Connection = Server.CreateObject("ADODB.Connection")
		dbConn = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
				"Data Source = "&Path&";" &_
				"Persist Security Info = FALSE"
		Connection.Open dbConn
		end sub

dim iDocId: iDocId="":if request("iDocId")<>"" then iDocId=request("iDocId")
if len(iDocId)>0 then 'doc id has a value
	 dim sDocQuery: sDocQuery="SELECT doc_checkedout, doc_title, doc_callno,
doc_location from lib_document where doc_seq = " & iDocId & ";"
	 call subOpenDBConn()
	 'dim connection
	 dim rsDoc
	 set rsDoc=connection.Execute(sDocQuery) 'line 20
	 response.write rsDoc(0) &"<HR>"
end if

Thanks to all who responded.

More information about the thelist mailing list