MaxTo
asked on
Cannot pass parentheses when calling function
This is my asp code used to call the function
<%
Dim user
set user = CreateObject("survey.dbCon nect")
user.displayData("SD","Sek olah","BJC 0000")
%>
Thi sis my function is used to create dll file
Public Function displayData(Optional db As String, Optional tb As String, Optional userName As String)
Dim sqlQry As String
getConnection (db)
sqlQry = "select *from " & tb & " where kod = " & userName
Set objRs = New ADODB.Recordset
objRs.Open sqlQry, objConn
objRs.MoveFirst
lastModify = objRs("LastModify")
address = objRs("Alamat")
...
objRs.Close
Set objRs = Nothing
End Function
here the question is i want pass the "SD", "Sekolah" and "BJC0000" into the function the error occurs.
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/index.asp, line 15, column 36
user.displayData("SD","Sek olah","BJC 0000")
-------------------------- ---------^
<%
Dim user
set user = CreateObject("survey.dbCon
user.displayData("SD","Sek
%>
Thi sis my function is used to create dll file
Public Function displayData(Optional db As String, Optional tb As String, Optional userName As String)
Dim sqlQry As String
getConnection (db)
sqlQry = "select *from " & tb & " where kod = " & userName
Set objRs = New ADODB.Recordset
objRs.Open sqlQry, objConn
objRs.MoveFirst
lastModify = objRs("LastModify")
address = objRs("Alamat")
...
objRs.Close
Set objRs = Nothing
End Function
here the question is i want pass the "SD", "Sekolah" and "BJC0000" into the function the error occurs.
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
/index.asp, line 15, column 36
user.displayData("SD","Sek
--------------------------
alternately you can call the function like this, when you dont want the out put of the function.
user.displayData "SD","Sekolah","BJC0000"
user.displayData "SD","Sekolah","BJC0000"
In that case you need not have a function,it would do with a subroutine
KC
KC
ASKER
To KC :
from your comment, i change it like this
<%
set user
Dim retVal
set user = Server.CreateObject("surve y.dbConnec t")
retVal = user.displayData("SD", "Sekolah", "JBC0000")
%>
Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.
/index.asp, line 13 ( set user = Server.CreateObject("surve y.dbConnec t")
)
from your comment, i change it like this
<%
set user
Dim retVal
set user = Server.CreateObject("surve
retVal = user.displayData("SD", "Sekolah", "JBC0000")
%>
Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.
/index.asp, line 13 ( set user = Server.CreateObject("surve
)
Have you registered your DLL file on the server ? This error is usually encountered when the Active-X DLL is not registered.
do this: Assuming the path of your dll is in C:\winnt\system32. Click start->Run
regsvr32 c:\winnt\system32\myDLL.dl l
KC
do this: Assuming the path of your dll is in C:\winnt\system32. Click start->Run
regsvr32 c:\winnt\system32\myDLL.dl
KC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry friends thanks for everybody help. This problem i had solved. so i will close this question if got chance next time i will give you people the mark and good grade.
Next time a good grade? - Hope you'll be able to explain some reasoning then, or even post any comment (for clarification).
This current situation with this question is unsatisfactory.
This current situation with this question is unsatisfactory.
Try this
Dim retVal
set user = Server.CreateObject("surve
retVal = user.displayData("SD","Sek
'When you call a function,a value will be returned and therefore you need to collect that value and when creating an instance of an active-x component on the server,you need to use server.createobject
Regards
KC