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

How to pass a variable to a stored procedure

Status
Not open for further replies.

pna3

Programmer
Dec 5, 2003
21
IN
I am using the MSHFlexiGrid to generate reports in my project. I have set the DataMember property of the MSHFlexigrid to an SQL Command written in the Data Environment.On the click of a button the report is viewed on the Screen. The report works fine. In this i have written a select statement which shows all the fields from the table.

However, when i want the report to be generated based on a particular date range, i would require to change the SQL statement to a stored procedure.But even if i do so, I do not know how to call it from the front end.
I require that on the click of the button the stored procedure in the Data Environment should pick up the values which would be selected by the User on the Screen.

Kindly help.
Urgent.
 
Simply on the on click generate on the run the SQL statement using & to add parameters to the query.
 
Thanx for the suggestion.

I wrote the following code in the Form Activate event but when i execute it the window goes on a hang. Please help

Set rstRPCAhmReport = Nothing
rstRPCAhmReport.Source = "set dateformat dmy select
cSerialNumber,cRegion,cRPC,dDateofReporting,cAccountNumber,cCustomerName,iC
hqTranAmount,iODAmount,vReasonforOD,cFinacleTranNumber,dFinacleTranDate,iTA
TforTODReporting,cTeam,cLoginID,cUsername,cSOLID,dDGMApproval,cDelayinRepor
ting,iActualTAT,cFinacleMaker,cFinacleChecker from TODRegister where
cRPC='" & strAhmedabad & "'"
rstRPCAhmReport.Open

If Not rstRPCAhmReport.EOF And Not rstRPCAhmReport.BOF Then
While Not rstRPCAhmReport.EOF
MSHFGAhmedabadReport.ColData(1) = rstRPCAhmReport.Fields(0)
MSHFGAhmedabadReport.ColData(2) = rstRPCAhmReport.Fields(1)
MSHFGAhmedabadReport.ColData(3) = rstRPCAhmReport.Fields(2)
Wend
End If

rstRPCAhmReport.Close

Please help this is very urgent
 
Well the reason for the hang almost has to be your while loop. You have it set to exit when rstRPCAhmReport.EOF is true, but I don't see how that's ever going to happen because nothing in your while loop moves the cursor. You might just need to add the line

rstRPCAhmReport.MoveNext

at the end of your loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top