Solved

ASP Parameter to MS Access

Posted on 2003-12-06
11
415 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

864 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now