Home > database >  Program error call a stored procedure
Program error call a stored procedure

Time:10-12

This is
//string ls_xh 
String ls_isbn
String ls_sm
String ls_zz
String ls_jg
String ls_lbbh
String ls_cbs
String ls_cbrq
String li_sl
//ls_xh=sle_1. Text
//if ls_xh='or isnull (ls_xh) then
//MessageBox (' system ', 'please enter the correct serial number')
//return
//end if
Ls_isbn=sle_2. Text
If ls_isbn='or isnull (ls_isbn) then
MessageBox (' system ', 'please enter the correct isbn)
Return
End the if
Ls_sm=sle_3. Text
If ls_sm='or isnull (ls_sm) then
MessageBox (' system ', 'please enter the correct title')
Return
End the if
Ls_zz=sle_4. Text
If ls_zz='or isnull (ls_zz) then
MessageBox (' system ', 'please enter the correct author')
Return
End the if
Ls_jg=sle_5. Text
If ls_jg='or isnull (ls_jg) then
MessageBox (' system ', 'please correct input prices)
Return
End the if
Ls_lbbh=sle_6. Text
If ls_lbbh='or isnull (ls_lbbh) then
MessageBox (' prompt ', please input the correct category id ')
Return
End the if
Ls_cbs=sle_7. Text
If ls_cbs='or isnull (ls_cbs) then
MessageBox (' system ', 'please enter the correct press')
Return
End the if
Ls_cbrq=sle_8. Text
If ls_cbrq='or isnull (ls_cbrq) then
MessageBox (' prompt ', 'please enter the correct date of publication')
Return
End the if
Li_sl=sle_9. Text
If li_sl='or isnull (li_sl) or li_sl=' 0 'then
MessageBox (' system ', 'please enter the correct number)
Return
End the if
Dec ld_jg
Ld_jg=dec (sle_5. Text)
Dec ld_sl
Ld_sl=dec (sle_9. Text)

DECLARE abc_proc1 PROCEDURE FOR p_bm_book_info @ t_isbn=: sle_2. Text, @ t_sm=: sle_3. Text, @ t_zz=: sle_4. Text, @ t_jg=: ld_jg, @ t_lbbh=: sle_6. Text, @ t_cbs=: sle_7. Text, @ t_cbrq=: sle_8. Text, @ t_sl=: ld_sl;
The EXECUTE abc_proc1;
MessageBox (' prompted 'SQLCA. SQLCODE)
If the SQLCA. SQLCODE=0 THEN
commit;
MESSAGEBOX (" prompt ", "successfully saved")
The else
rollback;
MESSAGEBOX (" error ", "save failed, the error code is" + sqlca. Sqlerrtext + "'")
Return
End the if
The close abc_proc1;



This process is to store
USE [pnyy]
GO
/* * * * * * Object: StoredProcedure [dbo] [p_bm_book_info] Script Date: 05/20/2017 07:42:11 * * * * * */
The SET ANSI_NULLS ON
GO
The SET QUOTED_IDENTIFIER ON
GO

The ALTER Procedure [dbo] [p_bm_book_info]

@ t_isbn varchar (30),
@ t_sm varchar (100),
@ t_zz varchar (50),
@ t_jg decimal (18, 2),
@ t_lbbh varchar (2),
@ t_cbs varchar (100),
@ t_cbrq varchar (10),
@ t_sl int
As
Declare @ rowcount varchar (100)
The begin
Insert into bm_book_info (isbn, sm, zz, jg, LBBH, CBS, CBRQ, sl) values (@ t_isbn, @ t_sm @ t_zz, @ t_jg, @ t_lbbh, @ t_cbs, @ t_cbrq, @ t_sl)
Select @ rowcount=count (sm) from bm_book_info where sm=@ t_sm

End
If @ rowcount=1
Return 1
The else
Return @ @ error

But the call is from the program will prompt the transaction not connected, SQL, sqlcode of 1
Excuse me what's the problem?

CodePudding user response:

Tip is very clear, the sqlca does not connect

CodePudding user response:

Sqlca the global variables not connect to the database, you need to connect to the database, and then execute the stored procedure

CodePudding user response:

refer to the second floor WorldMobile response:
sqlca the global variables not connect to the database, you need to connect to the database, and then execute the stored procedure
how to connect? Under the specific said bai, I'm a little white

CodePudding user response:

The SQLCA. DBMS="ADO.Net"//interface, also can have different interfaces such as ODBC
The SQLCA. LogPass=password
The SQLCA. LogId=user
The SQLCA. The AutoCommit=true//AutoCommit
SQLCA. DBParm="Namespace='System. Data. The OleDb', the Provider='SQLOLEDB', the DataSource='server, Database=' your Database, NCharBind=1"//connection properties, different interface, writing different

Connect using the sqlca;

Regarding the sqlca, or baidu know the good, a lot of resources online,

CodePudding user response:

Yes, check for connecting to the database

CodePudding user response:

Check the sqlca can use the sqlca handle if there is a connection,
  • Related