簡體   English   中英

如何從 Visual Foxpro 執行 MariaDB Store Proc?

[英]How to exec MariaDB Store Proc from Visual Foxpro?

我在 Maria DB 中有一個函數/存儲過程

CREATE DEFINER=`root`@`localhost` PROCEDURE `test1`(var1 varchar(100))
BEGIN
  select * from ttype where kode=var1;
END

我需要從存儲過程中獲取 cursor,如何在 vfp 應用程序中獲取 cursor,在 MariaDb/MySQL StoreProc 中獲取數據庫?

我在我的 Visual Foxpro 中嘗試這樣做:

Sqexec(kon,"call test1 ('ABC')","test") --> 沒有運行

但是當我像這樣使用常見的 select 時:

sqlexec(kon,"select * from ttype where kode='ABC'","test") -- 它運行良好..

“你能告訴我如何在我的案例中使用 aerror() 嗎?”

當任何 ODBC 遠程操作失敗時,您將始終使用 AError() function,即任何 Vfp 的SQL*()函數,例如SqlStringConnect()或您建議的

sqlexec(kon,"select * from ttype where kode='ABC'","test") --it's running well

&& 事實上,除非你像這樣評估它的返回值,否則你無法知道它是否“運行良好”

Local lnResult, laSqlErrors[1], lcErrorMessage
lnResult = SqlExec(kon,"select * from ttype where kode='ABC'","test")
If m.lnResult = –1 && as documented in the F1 Help
        AERROR(laSqlErrors)
        lcErrorMessage = ;
            TRANSFORM(laSqlErrors[1]) + ", " + ;
            TRANSFORM(laSqlErrors[2])
        && now write a log and/or inform the user
ENDIF
&& to be continued

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM