Hello everyone, I have a problem when I am debugging my code, it turns out that the code leads me to display an error message that I am getting after the expected error message. When I press my Search button I am getting the following error: "Invalid character value for cast specification", when really I'm expecting another error message. You can inspect my code that I execute inside my Search function:
IF THIS.inv_Payment.ids_Trans.Retrieve(THIS.is_Name,&
THIS.il_IrsCltId,&
THIS.is_Article, &
THIS.is_PayDate) > 0 THEN
// Share data with object
THIS.inv_Payment.ids_Trans.ShareData(dw_select)
// Set button
cb_Search.Default = FALSE
cb_OK.Default = TRUE
commit using sqlca;
RETURN TRUE
ELSE
gnv_App.of_Message("No matching rows found","Check the number, the client's ID or name")
cb_OK.Default = FALSE
cb_Search.Default = TRUE
commit using sqlca;
RETURN FALSE
END IF
In the first IF condition, when it does the Retrieve it is giving me an invalid casting error, but I can't see what I am doing wrong, what type of object is it waiting for, when all I am sending as an argument is a string. at can I be doing wrong? How can I fix or troubleshoot my problem?
To find out how to execute stored procedures for your DBMS, look up "DECLARE and EXECUTE" in the Powerbuilder help file.
The result set is generated by the SELECT statements within each block of the IF-ELSE conditions. The SELECT statements retrieve data from the pay_transaction table, joining with other tables (pay_item, pay_status, and irs_customer) to get additional information. The result set includes columns like id, irs_clt_id, name, paydate, amount, regdate, description, and pay_sts_id.
The conditions in the WHERE clauses of the SELECT statements filter the data based on the input parameters (@name, @idstr, @article, and @date). The specific conditions depend on the combination of parameter values and are structured in a way to handle different scenarios.
It's important to note that this stored procedure is using explicit transactions (BEGIN TRAN and COMMIT TRAN). However, the ROLLBACK TRAN statement is missing in my stored procedure.
In summary, yes, the stored procedure returns a result set based on the SELECT statements executed within the different branches of the IF-ELSE conditions.
the format of my date is mm/dd/yyyy
Thanks in advance for any idea. Now I am looking for how to call my stored procedure in my app directly. I want to do it in the moment of my retreive, well instead of my retrieve , that is my idea
Depending on your settings
select convert(datetime, '27/12/2023')
can fail, but
select convert(datetime, '27/12/2023', 103)
will do the job.
What is the exact and complete db error message that you get?
Can you execute the SP in the PowerBuilder Database Painter?