?
Solved

Need an expert's analysis of object type problem

Posted on 2001-06-22
3
Medium Priority
?
193 Views
Last Modified: 2013-12-03
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("URL"), 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("ErrorMessage")%></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 <????>?
0
Comment
Question by:svfafel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
preinsko earned 800 total points
ID: 6222477
To obtain underlying type use TypeName function

MyType = TypeName("VBScript") 'Returns a string
MyType = TypeName(4) 'Returns Integer
and so forth.

To determine if something is an object use IsObject function.

Dim myInt, myObj, bObj
Set myObj = Me
bObj=IsObject(myObj)  'Returns true
bObj=IsObject(myInt)  'Returns false
and so forth.

Hope this helps.  I use them a lot because when you deal with Variants everything is an unknown.

Cheers.
0
 
LVL 2

Expert Comment

by:preinsko
ID: 6222480
Sorry I didn't mean to propose this as an answer just a troubleshooting tip.
0
 

Author Comment

by:svfafel
ID: 6229267
Thanks...you helped me out tons...thanks!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question