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

How to read an output parameter in SQL Procedure From Vfp ?

Status
Not open for further replies.

COBART

MIS
Sep 7, 2000
33
ID
In SQL Server 7.0
I have a database of SQL Server 7.0 named PUSTAKA and its table named ANGGOTA

Structure of ANGGOTA
P.Key Column Name Datatype Length Prec
* No_Anggota Char 5 0 0 Nama Varchar 50 0 0 Alamat Varchar 50 0 0 Kantong Smallint 2 5 0 Terisi Smallint 2 5 0
I made a stored procedure in PUSTAKA named SP_ANGGOTA
Content of SP_ANGGOTA :
Create Procedure SP_ANGGOTA
@Action Char(1),
@No_Anggota Char(5),
@Nama VarChar(50),
@Alamat VarChar(50),
@Kantong SmallInt,
@StrError VarChar(255) Output
AS …

Parameter descriptions :
@Action : "I" for Insert Table
: "U" for Update Table
: "D: for Delete Table

@StrErr will return a value like: "Key already exist"

In Visual FoxPro 5.0

I have a database of VFP 5.0 named DATAKU.DBC and it has a connection called MySQL_Conn

I create a remote view named ViewAnggota, then I execute this following commands in command window:
Use ViewAnggota
Browse

Then I update a field, success

My Questions are:
1.I try to insert a record in ViewAnggota but I fail,why.. ?
2.I execute SP_ANGGOTA as follow :

gcNo_Anggota = "A0001"
gcNama = "Abdul"
gcAlamat = "Jakarta"
gnKantong = 1
gcReturn = ""

STORE SQLCONNECT("MySQL_Conn") TO gnConnHandle

= SQLSETPROP(gnConnHandle, 'Transactions', 2) && Manual transactions
= SQLEXEC(gnConnHandle, "EXEC SP_ANGGOTA 'I', gcNo_Anggota, ;
gcNama, gcAlamat, gnKantong, gcReturn Output")

= SQLCOMMIT(gnConnHandle) && Commit the changes
= SQLDISCONNECT(gnConnHandle)


Why that commands is not success?
How to make the right commands?

3.How to read an output parameter from SP_ANGGOTA (a stored procedure in SQL Server 7.0) ?

4.How to refresh ViewAnggota in a grid control which RecordSourceType = 1–Alias ?

5.How to create an online view ?


[sig][/sig]
 
In the Tek-tips VFP forum I have a FAQ on how to call a stored procured from VFP and receive a return. I also have on my site (link at the bottom of this message) in the Education several articles on VFP client-server. Between the two of these, most of your questions should be answered.

Your Q1: difficult to know without the error message.

Your Q4: usually, call the grid's Refresh method. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top