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!

Stored Procedure Call

Status
Not open for further replies.

rushtome

Programmer
May 13, 2003
4
IN
Hi,

I am executing a stored procedure written in ORACLE from VB. My problem is when I am executing this procedure from back end (i.e. ORACLE), I am getting the desired output/results. But if the same procedure is executed from VB, then the output is not what is desired.

I am unable to understand where the code is going wrong.

The procedure declaration in ORACLE is as follows,

procedure process_itax_calculation
(
p_run_id in number,
p_company in char,
p_emp_no in varchar2,
p_fin_year in char,
p_it_salary_head_cd in char,
p_it_it_type_cd in char,
p_future_months in number,
p_for_year in number,
p_for_month in number,
p_adhoc_it in char,
p_it_form in char
)
is
---some code here

begin

---some code here

end;


Following is the VB call to the above procedure....

Dim cmd_it_cal as New ADODB.Command

With cmd_it_cal
.ActiveConnection = CommonModule.cnn
.CommandType = adCmdStoredProc
.CommandText = "process_itax_calculation"
.Parameters.Append .CreateParameter("RunNo", adInteger, adParamInput, 6, li_run_no)
.Parameters.Append .CreateParameter("CoCd", adChar, adParamInput, 2, GS_COMP_CD)
.Parameters.Append .CreateParameter("EmpNo", adVarChar, adParamInput, 12, rs_tt_process_emp("emp_no").Value)
.Parameters.Append .CreateParameter("FinYr", adChar, adParamInput, 16, ls_fin_year)
.Parameters.Append .CreateParameter("TDSHead", adChar, adParamInput, 4, ls_tds_head_cd) '2006
.Parameters.Append .CreateParameter("Param1", adChar, adParamInput, 4, "9000")
.Parameters.Append .CreateParameter("FutureMonths", adInteger, adParamInput, 6, ln_future_months)
.Parameters.Append .CreateParameter("ForYear", adInteger, adParamInput, 6, li_for_yr)
.Parameters.Append .CreateParameter("ForMonth", adInteger, adParamInput, 6, li_for_month)
If ComboAdHocIT.Text = "No" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 1, "N")
ElseIf ComboAdHocIT.Text = "Yes" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 3, "Yes")
End If
.Parameters.Append .CreateParameter("Param3", adChar, adParamInput, 1, "N")
.Execute

End With

could anybody tell me where I am going wrong?

Thanks and Regards
rushtome

 
Hi rushtome
There is one abnormality I noticed in your code.
'Param2' has variable lengths (1 and 3) when ComboAdHocIT.Text = "No" and ComboAdHocIT.Text = "Yes"
I guess the correct code should read like,

If ComboAdHocIT.Text = "No" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 1, "N")

ElseIf ComboAdHocIT.Text = "Yes" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 1, "Y")

End If

I hope this helps. If not, please elaborate a little more on the problem you are facing. Pointers to any errors you are getting while trying to execute the stored procedure might help me to throw more light on the problem.

Cheers
Syed.
 
hi, Razvi

If ComboAdHocIT.Text = "No" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 1, "N")
ElseIf ComboAdHocIT.Text = "Yes" Then
.Parameters.Append .CreateParameter("Param2", adChar, adParamInput, 3, "Yes")
End If


The above code that I have written, is correct. I want to pass "N" if the combovalue is "No" and "Yes" if it is "Yes". I am handling these values like this only in the procedure.

I am not quite sure whether the above written code is making some difference.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top