[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

calling a vb dll function from an asp page.

Hi I have a function in a activex dll that is registered.
The function is a log in function and it takes two strings, one as name and one as password.

I am making the call from an asp page . Here it is

<%
       dim strName
      dim strPass
      strName = request.form("Name")
      strPass = request.form("pass")
      strPass = CStr(strPass)
      strName = Cstr(strName)
      
      dim objUSSC
      set objUSCC = server.CreateObject("sports.USSC")
      objUSSC.login (strName strPass)
      
%>

I get this error
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/sport/Default.asp, line 31, column 32
objUSSC.login (strName, strPass)

Thanks

0
shayne23d
Asked:
shayne23d
  • 12
  • 10
1 Solution
 
Brad Dobyns, CSMCommented:
Try this:

Call objUSSC.login(strName, strPass)

Brad
0
 
shayne23dAuthor Commented:
Ok I tried that and I got this error
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
0
 
Brad Dobyns, CSMCommented:
Or if that diesn't work try this:

objUSSC.login strName, strPass (without parenthases)

Brad
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
wendelinaCommented:
Usually, when receving the message "Cannot use parentheses when calling a Sub", all you'll have to do is remove the parentheses.

Try this instead:
objUSSC.login strName, strPass

Generally, parentheses are only necessary around the parameters sent to a Function which will return a value to the point at which it was called.
0
 
Brad Dobyns, CSMCommented:
Little late wendelina... :o)

Brad
0
 
shayne23dAuthor Commented:
tried that and I get  the error
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/sport/Default.asp, line 31


0
 
shayne23dAuthor Commented:
I am calling a function as boolean that returns true or false
0
 
Brad Dobyns, CSMCommented:
Did you register the DLL on your server?

Brad
0
 
shayne23dAuthor Commented:
yes i did. Is my call to cast the varaint as string correct?
could that be the problem?

0
 
Brad Dobyns, CSMCommented:
That could be it if the two methods I mentioned didn't work and the DLL is registered. Is the type Bool or is the type Sting?

Brad
0
 
shayne23dAuthor Commented:
the type is boolean
0
 
Brad Dobyns, CSMCommented:
Are you using toBool or asBool?

Brad
0
 
shayne23dAuthor Commented:
as boolean
0
 
Brad Dobyns, CSMCommented:
And is .login a correct method of the class USSC?

Brad
0
 
shayne23dAuthor Commented:
yes it is.  by the way thanks for the work yo uare doing
any other thoughts?
0
 
Brad Dobyns, CSMCommented:
You are welcome. :o)

Have you tested the function to make sure it will accept the two values and return the value "true" or "false"?

Brad
0
 
shayne23dAuthor Commented:
yes Before moving it over to a dll I tested it as vb project and it did just fine.

0
 
Brad Dobyns, CSMCommented:
The error code is what has me stumped. If the DLL is registered and you have tested the function beforehand, and you have created the object correctly and made a call to the function or method within the DLL... What the heck is the problem?

Brad
0
 
shayne23dAuthor Commented:
i have not created any get  let methods. i have only created a public function login.
Do i need to write get and let methods for asp to work.
it seems that I should be able to call a public fucntion and pass the varaibles from the asp to the dll
I am not worried about incapsulation I am just trying to get the aps and object to talk
Here is the vb functionPublic Function login(ByVal strName As String, ByVal strPass As String) As Boolean

   Dim strN As String
   Dim strP As String
   strN = strName
   Debug.Print strN
   Dim strCheckN As String
   Dim strCheckP As String
   
   strP = strPass
   
   
   Dim rs As ADODB.Recordset
   
   Dim cn As ADODB.Connection
   Dim cmd As ADODB.Command
   
   Set cn = New ADODB.Connection
   cn.CONNECTIONSTRING = CONNECTIONSTRING
   cn.Open
   
   Set cmd = New ADODB.Command
   cmd.ActiveConnection = cn
   cmd.CommandText = "select * from customer where customer_Login = " & "'" & strN & "'"
   
   
   cmd.CommandType = adCmdText
   
   Set rs = New ADODB.Recordset
   rs.Open cmd, , adOpenKeyset, adLockOptimistic
   'strCustID = rs.Fields("customer_ID").Value
   strCheckN = rs.Fields("customer_Login").Value
   strCheckP = rs.Fields("customer_Email").Value
   
   
   
   
   
   strP = Trim$(strP)
   strN = Trim$(strN)
   strCheckN = Trim$(strCheckN)
   strCheckP = Trim$(strCheckP)
   
   strPassword = Trim$(strPassword)
   If (strP = strCheckP) Then
   strCustID = rs.Fields("customer_ID").Value
   Debug.Print strCustID
   Debug.Print "You have logged in"
   
      login = True
     
   Else
      login = False
   End If
   

End Function
0
 
Brad Dobyns, CSMCommented:
I just noticed something really basic and I don't know whether you caught it or not:

dim objUSSC
set objUSCC = server.CreateObject("sports.USSC") <--- Look at the object being created. (USCC vs USSC)
objUSSC.login (strName strPass)

Did you fix this already? That may be what's causing the error. DOH!

Brad
0
 
shayne23dAuthor Commented:
doh     Man oh man
thanks
0
 
Brad Dobyns, CSMCommented:
Boy, do I feel stupid as hell...TGIF!!!!

Brad
0
 
Brad Dobyns, CSMCommented:
Thanks for the points!! Good Luck!

Brad
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!

  • 12
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now