VB object return wrong value in ASP page 
Author Message
 VB object return wrong value in ASP page

I am using VB 4.0 32 bit to create my object. My NT 4.0 server has IIS 3.0
and ASP installed on it. I have a VB object called StringProcess with
clsIstring as the class name, and I registered the object on the NT server.
When I call the object from another VB program (lTopicKey =
Istring.IField(sTopicKeyLst, ",", ix)), I got the correct return value
(lTopicKey = 1), but when I call it from an ASP page (<%lTopicKey =
Istring.ifield(sTopicKeyLst,",",ix)%>),
I got blank as the return value (lTopicKey = blank). Could you pls let me
know what I did wrong? Thank you very much in advance.

The following is some code from my ASP page:

<%Set Istring = Server.CreateObject("StringProcess.clsIstring")
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.Open "ABC"
sSQL = "SELECT TOPIC_KEY FROM TOPIC"
Set rs = dbConnection.Execute(sSQL)
sTopicKeyLst = ""
Do While Not rs.EOF%>
<script language="VBScript">
           outline.AddItem "<%=rs("TOPIC_KEY")%>"
           sTopicKeyLst = sTopicKeyLst & "," & <%=rs("TOPIC_KEY")%>
</script>
    <%rs.MoveNext
    Loop
    rs.close
    dbConnection.close%>
<script language="VBScript">
sTopicKeyLst = mid(sTopicKeyLst,2)
</script>

<script language="VBScript">
Sub SetTopicKey()
    ix = outline.listindex + 1
    msgbox ix
    msgbox sTopicKeyLst
    <%lTopicKey = Istring.ifield(sTopicKeyLst,",",ix)%>
    msgbox "<%=lTopicKey%>"                     ---->>>>>>>> RESULTED IN BLANK
    <%Session("TopicKey") = lTopicKey%>
end sub
</script>

The following is another VB program that calls the object:

    Dim Istring As Object ' Declare variable to hold the reference.

    Set Istring = CreateObject("StringProcess.clsIstring")
    sTopicKeyLst = "0,1,48,49,50"
    ix = 2
    lTopicKey = Istring.IField(sTopicKeyLst, ",", ix)         ---->>>>>>>>
RESULTED IN 1

The following is the VB object

Public Function IField(st, substr, cnt)
:
:
  IField = Trim(txt)
End Function



Fri, 17 Sep 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. problem using component with asp page -- result of function not returned, instead original value returned

2. how to return a value from a ocx object in asp

3. Wrong interface returned to ASP from VB, only when compiled

4. Page Object DTC doesnt return values

5. Returning an object with sub objects from vb component (COM) to ASP

6. parameter doesn't return value to ASP or VB

7. Returning data from a vb component back to my asp page

8. Returning data from a vb component back to my asp page

9. Returning Recordset and Return Value from Command Object

10. read Value in vb from ASP page

11. Single-point calculation returning wrong value

12. VB COM Object not returning reference argument value

 

 
Powered by phpBB® Forum Software