Home > database >  Original concept connects the Sybase stored procedure
Original concept connects the Sybase stored procedure

Time:09-21

I am using PB9 connection has built in sybase stored procedure with the return value, then there is an error code:
"Space must be allocated for the bind parameter"
This is how to return a responsibility??
My PB code is as follows:
DECLARE add_account PROCEDURE FOR sp_add_account
@ acc_email=: acc_email,
@ acc_password=: acc_password,
@ acc_type=: acc_type,
@ err1out=: err1 output,
@ err2out=: err2 output,
@ succout=: succ output
Using the SQLCA.

The EXECUTE add_account;

If the SQLCA. SQLCode=0 then
The FETCH add_account INTO: err1 and err2, : succ.
If err1="and" err2="" then
MessageBox (" success ", succ)
Elseif err2="" and succ=" "then
MessageBox (" error ", err1)
Elseif err1="" and succ=" "then
MessageBox (" error ", err2)
End the if
The close add_account;
Open (register)
The else
Is_msg=SQLCA. SqlErrText
MessageBox (Execute "failed", string (SQLCA. Sqlcode) + is_msg)
Return

End the if
End the if

Sybase stored procedures:

The create proc sp_add_account
(@ acc_email varchar (80), @ acc_password varchar (10), @ acc_type varchar (80), @ err1out varchar (80) out, @ err2out varchar (80) out, @ succout varchar (80) out,)
As
The begin
/* check if this email address has existed */
If the exists (select 1 from the account where the lower (acc_email)=the lower (@ acc_email))
The begin
The set @ err1out='This account from the existed'
Return
End
/* check if the type is valid */
If (the lower (@ acc_type) & lt;> 'admin' or lower (@ acc_type) & lt;> 'customer')
The begin
The set @ err2out='not a valid account type'
Return
End
The else
The begin transaction
Insert into account
Values
(the lower (@ acc_email), @ acc_password, @ acc_type)
The set @ succout='add a new account'
Commit
End
If @ @ error<> 0
The begin
The rollback transaction
End

It a lot, but not be solution ~ ~
I am a rookie, PB great god guide, genuflect is begged,

CodePudding user response:

How no one I,,,

CodePudding user response:

DECLARE add_account PROCEDURE FOR sp_add_account
@ acc_email=: acc_email,
@ acc_password=: acc_password,
@ acc_type=: acc_type,
@ err1out=: err1 output,
@ err2out=: err2 output,
@ succout=: succ output
Using the SQLCA.
To try the following


DECLARE add_account PROCEDURE FOR sp_add_account
@ acc_email=: acc_email,
@ acc_password=: acc_password,
@ acc_type=: acc_type
Using the SQLCA.

CodePudding user response:

Or


The EXECUTE add_account;

Before the three input parameters are assigned values, likely caused by the parameter is empty

CodePudding user response:

This is how we call
Ldt_today=wi_nvo_server. Uf_servertime ()
the sqlca. The autocommit=true
Declare report_gethours procedure for dbo. Report_gethours_sp @ sdate=: indate, @ edate=: ldt_today, @ hours=: li_hours output using the sqlca.
The execute report_gethours;
The fetch report_gethours into: li_hours;
The close report_gethours;
the sqlca. The autocommit=false

You add red font code try

CodePudding user response:

refer to the second floor lzp_lrp response:
DECLARE add_account PROCEDURE FOR sp_add_account
@ acc_email=: acc_email,
@ acc_password=: acc_password,
@ acc_type=: acc_type,
@ err1out=: err1 output,
.

I have just tried, but then an error says "parameter err1out is expected." "

CodePudding user response:

reference 4 floor baiynije response:

this is how we callLdt_today=wi_nvo_server. Uf_servertime ()
The sqlca. The autocommit=true
Declare report_gethours procedure for dbo. Report_gethours_sp @ sdate=: indate, @ edate=: ldt_today, @ hours=: li_hours...

Not tried, oh ~ ~

CodePudding user response:

You pass parameters is null values? You try with an empty string

CodePudding user response:

The
reference 7 floor baiynije response:
you send parameter is a null value? You with an empty string try

I use a null value "" (empty string), but still won't do oh ~ ~

CodePudding user response:

Warrior, come and help me to do the graduation design, the urgent need ~ thank you ~

CodePudding user response:

Consult the post
http://bbs.csdn.net/topics/60166517
  • Related