com dll and asp problem

Results 1 to 3 of 3

Thread: com dll and asp problem

  1. #1
    Join Date
    Dec 1969

    Default com dll and asp problem

    I&#039;m trying to learn com and have compiled this dll successfully.<BR><BR>Private intVal1 As Integer<BR>Private intVal2 As Integer<BR>Dim objContext As ScriptingContext<BR><BR>Sub OnStartPage(objSC As ScriptingContext)<BR> Set objContext = objSC<BR>End Sub<BR><BR>Public Function showResult() As Boolean<BR> intVal1 = Trim(objContext.Request.Form("intVal1"))<BR> intVal2 = Trim(objContext.Request.Form("intVal2"))<BR> If intVal1 = "" Or Not IsNumeric(intVal1) Then<BR> objContext.Response.Write "You did not enter a valid number for intVal1"<BR> End If<BR> If intVal2 = "" Or Not IsNumeric(intVal2) Then<BR> objContext.Response.Write "You did not enter a valid number for intVal2"<BR> End If<BR> If intVal1 = intVal2 Then<BR> showResult = True<BR> Else<BR> showResult = False<BR> End If<BR>End Function<BR><BR>Later, I call this in my asp page with this code.<BR><BR>&#060;%<BR>dim objTest, result<BR>set objTest = server.createobject("CalcTest.Adder")<BR>result = objTest.showResult()<BR>if result = false then<BR>response.write "The numbers were not the same."<BR>else<BR>response.write "The numbers were the same."<BR>end if<BR>%&#062;<BR><BR>When I submit my form, I get a type mismatch error for the line that says:<BR><BR>result = objTest.showResult()<BR><BR>I&#039;m new to creating dlls, so can anyone tell me what I&#039;m doing wrong here? Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: com dll and asp problem

    This may not be the answer but I noticed something in your code which may help fix this issue.<BR><BR>Request.Form values are passed as strings.<BR>You may have known this and so you stuck in:<BR> <BR>"if not isnumeric(whatever) then"<BR><BR>but to the isnumeric function 100 and "100" are evaluated as numeric.<BR><BR>So you should CInt() your variables before proceeding to the comparison.

  3. #3
    krishna Guest

    Default RE: com dll and asp problem

    hi,<BR>sorry ,i am not giving u the solution,when i was going thru ur code,i saw "OnStartPage" in dll code,is this mrthod retiurn by u to instantiate objectcontext,then u should call it,pls clear my doubt,my id is,<BR>bye<BR>krishna

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts