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

Wrong number of arguments or invalid property assignment:

Status
Not open for further replies.

clanm

Programmer
Dec 26, 2005
237
US
If I run the following code I get:

Wrong number of arguments or invalid property assignment: 'FunctDBSelect'

The code will work if:
session("sessionDB") is blank

The .asp page is:
<!--#include file="VBFunctions.inc" -->
<%
if session("sessionDB") <> "" then
test = FunctDBSelect(session("sessionDB"))
varDSN = FunctDBSelect(FunctDBSelect)
else
varDSN = "sns_prod"
end if
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open varDSN
%>

the VBFunctions.inc file has the code of:
<%Function FunctDBSelect(useDB)
select case useDB
case "ADSFO"
FunctDBSelect = "ADSFO_prod"
case "AFSS"
FunctDBSelect = "AFSS_prod"
case "CHS"
FunctDBSelect = "CHS_prod"
case "Demo"
FunctDBSelect = "Demo_prod"
case "EP"
FunctDBSelect = "EP_prod"
case "NSS"
FunctDBSelect = "NSS_prod"
case "OE"
FunctDBSelect = "OE_prod"
case "PMP"
FunctDBSelect = "PMP_prod"
case "RN"
FunctDBSelect = "RN_prod"
case "SP"
FunctDBSelect = "SP_prod"
case "SS"
FunctDBSelect = "SS_prod"
case "WI"
FunctDBSelect = "WI_prod"
case "WSO"
FunctDBSelect = "WSO_prod"
return FunctDBSelect()
end select
End Function%>
 
If you read my response to your previous post I have already mentioned you would get that error, why you would get that error, and what the correction would be to solve that error.

barcode_1.gif
 
On this line:
varDSN = FunctDBSelect(FunctDBSelect)

YOu appear to be calling the function and giving the function as the parameter. I have no clue why you would want to do this, but even if there were a good reason, you do not give a parameter for the second function call. Hence the wrong number of arguments error.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Which lines is the error on?

Do a response.write on 'test' and also 'varDSN' to see what is being passed back. The error is in those functions. if session("sessionDB") is blank is skips those hence no error.

It might help to paste the SQL statement it returns as well.
 
Tarwn is right...he answered this already in the other thread.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
thread333-1193330 - original post - also outlines the other error you will get (second to last line of function)

barcode_1.gif
 
Thanks to all who replied!
yes, Tarwn answered my question on the previous post. I also turned off "friendly messages" and that helped too!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top