Solved

ASP Parameter to MS Access

Posted on 2003-12-06
11
412 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:mcrmg
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Could you post the rest of the code so that i could check what the problem could be..

Cheers!!
0
 

Author Comment

by:mcrmg
Comment Utility
I forgot the order of the parameters that send to the sp.

:)


Thanks 4 the help
0
 
LVL 21

Expert Comment

by:ap_sajith
Comment Utility
Glad you solved the problem.. Thanks for the points...

Cheers!!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

8 Experts available now in Live!

Get 1:1 Help Now