Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning data from access using ADO

Status
Not open for further replies.

Mecurio

MIS
Oct 23, 2000
18
GB
I've just changed over my intranet server from NT4/IIS4 to 2k/IIS5. Now one of the sections of our helpdesk doesn't work:


Function getLogDetails(logID)
SET DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Provider = "MSDASQL"
DBConn.Open "DSN=helpdesk;UID=;PWD=;"
Set Session("DBConn") = DBConn
SQL1 = "SELECT [RequestID], [Text], [Date], [TechNote] FROM Log WHERE [ID] = " & CInt(logID)
SET rs1 = Server.CreateObject("ADODB.RecordSet")
rs1.Open SQL1, DBConn, 3,3
' Does this log exist ?
if (rs1.recordcount <> 1) then
getLogDetails = &quot;-1&quot;
else
For Each Item in rs1.Fields
returnString = returnString & Item.Value & &quot;^&quot;
Next
getLogDetails = returnString
End if
rs1.close
Set rs1 = Nothing
DBConn.Close
Set DBConn = Nothing
End Function


It keeps returning nothing. I tried running the query from withing Access itself and it returns the data. I think the ADO connection is working as other parts of the system work OK. Is there anything that could affect this between versions? I thought it was a problem with IIS to begin with but since have narrowed it down to this one function.

TIA

Rowan
 
Oops, that bit does work. Here's the one that doesnt:

Function getRequestDetails(requestID)
SET DBConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DBConn.Provider = &quot;MSDASQL&quot;
DBConn.Open &quot;DSN=helpdesk;UID=;PWD=;&quot;
Set Session(&quot;DBConn&quot;) = DBConn
thisID = requestID
SQL1 = &quot;SELECT [LoggedByID], [LoggedforID], [Subject], [Description], [Priority], [Application], [OS], [Category], [Status], [TechnicianID], [Date] FROM Request WHERE [RequestID] = &quot; & thisID
SET rs1 = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
rs1.Open SQL1, DBConn, 3,3
'Does this request exist ?
if (rs1.recordcount <> 1) then
getRequestDetails = &quot;-1&quot;
else
For Each Item in rs1.Fields
returnString = returnString & Item.Value & &quot;^&quot;
Next
getRequestDetails = returnString
End if
rs1.close
Set rs1 = Nothing
DBConn.Close
Set DBConn = Nothing
End Function

This is called from one asp page as so:

function getRequestDetails (requestID) {
//Get request deatils
alert(requestID);
co = RSExecute(&quot;RShelpdesk.asp&quot;,&quot;getRequestDetails&quot;,requestID);
alert (co.status);
if (co.status == -1) {
WriteError(co.data);
alert (&quot;Unable to retrieve details of logged help request. ID = &quot; + requestID);
return;
}



Getting rather bemused now. I can't see any real difference between the two. I've checked to make sure that the request ID is being passed to the getRequestDetails and it definately is. The return is definately -1 from the function tho.
 
Hmm (this is a slightly one sided conversation - feel free to butt in ;-) )

I've noticed that the functions that don't work properly are all in a separate script (RSHelpdesk.asp) is there perhaps a problem with remote scripting? (apologise for the newbieness of this - rather steep learning curve for me!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top