svfafel
asked on
Need an expert's analysis of object type problem
I have a problem with data/object types. Here's a function that is being called:
'************************* ********** ********** *********
Function getData(object, method, criteriaValue, criteriaValue2, orderBy, pageSize, pageNumber)
On Error Resume Next
Dim cmd, rs, retryCount, retryFlag, numPerPage
retryCount = 1
retryFlag = 1
Set cmd = Server.CreateObject("ADODB .Command")
With cmd
.ActiveConnection = cnn
.CommandTimeout = 240
.CommandType = adCmdStoredProc
.CommandText = object & "_" & method
.Parameters.Refresh
.Parameters("@SessionID")= sessionID
End With
writeParameters cmd
Set rs = cmd.Execute()
If Err.Number <> 0 Then
logError Request.ServerVariables("U RL"), Err.Number, Err.Description
End If
retryCount = retryCount + 1
If (rs.State = 0) Then
retryFlag = 1
ElseIf (rs.EOF) Then
retryFlag = 1
Else
retryFlag = 0
End If
Wend
If ((rs.State > 0) And Not(rs.EOF)) Then
rs.MoveFirst
End If
If Not(IsNull(pageSize)) AND (rs.State > 0) And Not(rs.EOF) Then
rs.CacheSize = pageSize
rs.PageSize = pageSize
rs.AbsolutePage = pageNumber
End If
On Error GoTo 0
closeCommand cmd ' Close command object
Set getData = rs
End Function
************************** ********** ********** **********
Here's the calling Sub:
************************** ********** ********** **********
Sub displayError
Dim rsError
rsError = getData("Error", "Get","","","","","")
%>
<FONT COLOR="RED"><B><%=rsError( "ErrorMess age")%></B ></FONT>
</FONT><BR><HR>
<%End Sub%>
************************** ********** ********** ********** *
the problem is this...the rsERROR object being returned is an ADO recordset, but after the "rsError=getdata(etc.)" call, the rsError variable is not a proper ADO Recordset object (I am purposefully aware of the absence of the SET keyword). What type of object is it? I can still retrieve data from it using rsError("FieldName") but not with rsError.Fields("FieldName" ). Weird to me. I thought for sure it would fail without the SET keyword but it doesn't. Any experts out there know what's going on? implicit conversion to object type <????>?
'*************************
Function getData(object, method, criteriaValue, criteriaValue2, orderBy, pageSize, pageNumber)
On Error Resume Next
Dim cmd, rs, retryCount, retryFlag, numPerPage
retryCount = 1
retryFlag = 1
Set cmd = Server.CreateObject("ADODB
With cmd
.ActiveConnection = cnn
.CommandTimeout = 240
.CommandType = adCmdStoredProc
.CommandText = object & "_" & method
.Parameters.Refresh
.Parameters("@SessionID")=
End With
writeParameters cmd
Set rs = cmd.Execute()
If Err.Number <> 0 Then
logError Request.ServerVariables("U
End If
retryCount = retryCount + 1
If (rs.State = 0) Then
retryFlag = 1
ElseIf (rs.EOF) Then
retryFlag = 1
Else
retryFlag = 0
End If
Wend
If ((rs.State > 0) And Not(rs.EOF)) Then
rs.MoveFirst
End If
If Not(IsNull(pageSize)) AND (rs.State > 0) And Not(rs.EOF) Then
rs.CacheSize = pageSize
rs.PageSize = pageSize
rs.AbsolutePage = pageNumber
End If
On Error GoTo 0
closeCommand cmd ' Close command object
Set getData = rs
End Function
**************************
Here's the calling Sub:
**************************
Sub displayError
Dim rsError
rsError = getData("Error", "Get","","","","","")
%>
<FONT COLOR="RED"><B><%=rsError(
</FONT><BR><HR>
<%End Sub%>
**************************
the problem is this...the rsERROR object being returned is an ADO recordset, but after the "rsError=getdata(etc.)" call, the rsError variable is not a proper ADO Recordset object (I am purposefully aware of the absence of the SET keyword). What type of object is it? I can still retrieve data from it using rsError("FieldName") but not with rsError.Fields("FieldName"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry I didn't mean to propose this as an answer just a troubleshooting tip.
ASKER
Thanks...you helped me out tons...thanks!!!