Solved

ASP Parameter to MS Access

Posted on 2003-12-06
11
417 Views
Last Modified: 2012-06-27
Hi,

I am using ASP as frontend to send parameters to Access queries.

If I send iAgingi and iAgingj alone OR iFICO alone, it works fine.  However, if I put all 3 together, it alwasys retuen 0 records.  But if I run the query in Aceess, it is fine.  Any ideas?  Thanks


Set pm = oCmd.CreateParameter("iAgingi", adInteger, adParamInput, , iAgingi)
oCmd.Parameters.Append pm

Set pm = oCmd.CreateParameter("Agingj", adInteger, adParamInput, , iAgingj)
oCmd.Parameters.Append pm

Set pm = oCmd.CreateParameter("iFICO", adInteger, adParamInput, , iFICO)
oCmd.Parameters.Append pm
0
Comment
Question by:mcrmg
  • 7
  • 4
11 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9890854
Try..

With oCMD
.activeconnection="connectionstring/object"
.commandText="StoredProcedure"
.CommandType = acCmdStoredProc
.Parameters.Append.CreateParameter("iAgingi", adInteger, adParamInput, , iAgingi)
.Parameters.Append.CreateParameter("Agingj", adInteger, adParamInput, , iAgingj)
.Parameters.Append.CreateParameter("iFICO", adInteger, adParamInput, , iFICO)
.Execute
End With

Cheers!!
0
 
LVL 21

Assisted Solution

by:ap_sajith
ap_sajith earned 500 total points
ID: 9890860
Should be...

With oCMD
.activeconnection="connectionstring/object"
.commandText="StoredProcedure"
.CommandType = acCmdStoredProc
.Parameters.Append.CreateParameter("iAgingi", adInteger, adParamInput,0, iAgingi)
.Parameters.Append.CreateParameter("Agingj", adInteger, adParamInput,0, iAgingj)
.Parameters.Append.CreateParameter("iFICO", adInteger, adParamInput,0, iFICO)
.Execute
End With

Cheers!!
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 500 total points
ID: 9890869
Alternatley, you could try using the connection.execute method to execute the sp..

eg:

set rsOutput=objConn.Execute("sp_somename " &  iAgingi & "," & iAgingj & "," & iFICO)

Cheers!!
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:mcrmg
ID: 9890912
I use the following, and the error msg.  



With oCmd
.Parameters.Append.CreateParameter "Deal", adInteger, adParamInput,50, sDeal
.Parameters.Append.CreateParameter "iAgingi", adInteger, adParamInput,0, iAgingi
.Parameters.Append.CreateParameter "Agingj", adInteger, adParamInput,0, iAgingj
.Parameters.Append.CreateParameter "iFICO", adInteger, adParamInput,0, iFICO
.Execute
End With

oRs.Open oCmd,,-1

Wrong number of arguments or invalid property assignment: 'Parameters.Append'
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9890975
Try..

Set oCmd=Server.CreateObject("ADODB.COMMAND")
With oCmd
.Parameters.Append.CreateParameter "Deal", adInteger, adParamInput,50, sDeal
.Parameters.Append.CreateParameter "iAgingi", adInteger, adParamInput,50, iAgingi
.Parameters.Append.CreateParameter "Agingj", adInteger, adParamInput,50, iAgingj
.Parameters.Append.CreateParameter "iFICO", adInteger, adParamInput,50, iFICO
End With

oRs.Open oCmd,objConn,1,3

I assume that you have included the adovbs.inc file..

Cheers!!
0
 

Author Comment

by:mcrmg
ID: 9890995
I am still getting this error.

Wrong number of arguments or invalid property assignment: 'Parameters.Append'


if I use this separately, it works fine. That bothers me.  Thans,.

Set pm = oCmd.CreateParameter("iAgingi", adInteger, adParamInput, , iAgingi)
oCmd.Parameters.Append pm

Set pm = oCmd.CreateParameter("Agingj", adInteger, adParamInput, , iAgingj)
oCmd.Parameters.Append pm

Set pm = oCmd.CreateParameter("iFICO", adInteger, adParamInput, , iFICO)
oCmd.Parameters.Append pm
0
 

Author Comment

by:mcrmg
ID: 9891006
I think that's something with this

Set pm = oCmd.CreateParameter("iAgingi", adInteger, adParamInput, , iAgingi)
oCmd.Parameters.Append pm

Set pm = oCmd.CreateParameter("Agingj", adInteger, adParamInput, , iAgingj)
oCmd.Parameters.Append pm

because I have about 6 or 7 parameters, when I combine them except these two, it works fine.  Once I add them in, it returns me 0 reacords.
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9891187
Are you sure that  iAgingi &  iAgingj return valid values?

Do a response.write on these two variables and see what they return... also, make sure that the name of the Input parameters for the sp are  iAgingi &  iAgingj respectively.

Cheers!!
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9891459
Could you post the rest of the code so that i could check what the problem could be..

Cheers!!
0
 

Author Comment

by:mcrmg
ID: 9891941
I forgot the order of the parameters that send to the sp.

:)


Thanks 4 the help
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 9891986
Glad you solved the problem.. Thanks for the points...

Cheers!!
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question