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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing .dll

Status
Not open for further replies.

Alira

Programmer
Mar 21, 2001
77
CA
Hello everybody!
I don't have experience with ASP and need your help.
When user clicks on submit button ASP code has to call a function from a .dll.
Here is a code:

dim objfirst

sTelephone = Request.Form("PhoneNo")
sClient_Name = Request.Form("Name")
sTopic = Request.Form("TypeofQuery")
sExpires = Request.Form("Expire")
sHours = Request.Form("Hours")

'Create an instance of the Component '
Set objfirst = Server.CreateObject("IQWCBR.WCBR")

'Call the function in component, and store the result'
objfirst.SendRequest(sIPAdd,sTelephone,sClient_Name,sTopic,sExpires,sHours)

%>

The error I get is"
"Cannot use parentheses when calling a Sub"

Please guide me here:)



 
All you need here is just to remove the parentheses. Unless you are specifically expecting a return value where you are setting a variable = to the return value you do not use parentheses. You just need a space between the Method you are calling and the parameters you are passing.


objfirst.SendRequest sIPAdd,sTelephone,sClient_Name,sTopic,sExpires,sHours

That should do it....

If you are expecting a value returned by the method then you would set it up like:


MyVariable = objfirst.SendRequest(sIPAdd,sTelephone,sClient_Name,sTopic,sExpires,sHours)

And you would have to surround your parameters with parentheses.

Hope this helps....
 
If I do as you showing I get "Type missmatch" error.
 
I would double check that you are passing what the dll is expecting. That can generally cause a type mismatch error if you try passing a different type than the dll expects. Let me know what you find out or if I can offer some more help.
 
This is a function from dll

Option Explicit

Public Function SendRequest(sIPAdd As String, sTelephone As String, sClient_Name As String, sTopic As String, _
sExpires As String, Optional sHours As String = 0) As String

Dim sRtn As String

gsIPAdd = sIPAdd
gsTelephone = sTelephone
gsClient_Name = sClient_Name
gsTopic = sTopic
giExpires = CInt(sExpires) '1 for YES and 0 for NO
giHours = CInt(sHours)


sRtn = frmMail.StartMail

If sRtn = "Success" Then
App.LogEvent "Web Callback Submitted Successfully.", vbLogEventTypeInformation
SendRequest = "Success"
End If

End Function

If I understand correctly all values from the form are String-type variables.
What could be the problem?
 
Hmmm...You might try changing the following line:

Public Function SendRequest(sIPAdd As String, sTelephone As String, sClient_Name As String, sTopic As String, _
sExpires As String, Optional sHours As String = 0) As String


You might add quotes around 0:

Public Function SendRequest(sIPAdd As String, sTelephone As String, sClient_Name As String, sTopic As String, _
sExpires As String, Optional sHours As String = "0") As String

I don't know if this will help. Is there any way that you can step through the code in debug mode? This would be an easy way to see what is causing the error. I also notice that this is a function so you could change your asp code to accept the value returned by the function.

You could modify the following:


'Call the function in component, and store the result'
Dim blnSendRequest
blnSendRequest = objfirst.SendRequest(sIPAdd,sTelephone,sClient_Name,sTopic,sExpires,sHours)


Make sure to put the parentheses back around your parameters. Give these changes a shot and see what happens.
 
Below iam giving solution. Only mistake in calling SendRequest function (remove pranthesis). Below u see the code
dim objfirst

sTelephone = Request.Form("PhoneNo")
sClient_Name = Request.Form("Name")
sTopic = Request.Form("TypeofQuery")
sExpires = Request.Form("Expire")
sHours = Request.Form("Hours")

'Create an instance of the Component '
Set objfirst = Server.CreateObject("IQWCBR.WCBR")

'Call the function in component, and store the result'
objfirst.SendRequest sIPAdd,sTelephone,sClient_Name,sTopic,sExpires,sHours

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top