Solved

ASP Parameter to MS Access

Posted on 2003-12-06
11
423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 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