[pb] 如何動態產生資料來源為預存程序的資料視窗?整理

來源:互聯網
上載者:User

oracle 嵌套進參數

string ls_arg 
ls_arg = "100" //測試參數
sqlselect = 'execute EOS.HHQUERY;0 AI_A ='+ls_Arg+'" arguments=(("AI_A", number))'
ls_Syn = sqlca.SyntaxFromSQL ( sqlselect, "", err )

 

--測試 1

oracle 測試成功:
1、一個參數
string num = "20"
sqlselect = 'execute SP_TEST;0 NUM = ' + num + '" arguments=(("NUM", number))' 

2、多個參數
string num = "20", sname = "'受理'"
sqlselect = 'execute SP_TEST;0 NUM = ' + num + ',SNAME = ' + SNAME + '" arguments=(("NUM", number),("SNAME", string))'

 

 

在MSSQL中的方法:

string num="20",sname="受理"
sqlselect = 'execute SP_TEST;1 @num = ' + num + ',@sname = ' + SNAME

--測試 2
CREATE PROCEDURE dbo.get_shortmsg
@mobile char(11),@msg varchar(140)
AS
begin
set nocount on
set rowcount  20
    if (substring(@mobile,1,3)>='134' and substring(@mobile,1,3)<='139')
         select *  from   shortmessage_bak
    else if  (substring(@mobile,1,3)>='130' and substring(@mobile,1,3)<='133')
        select * from free_mobile
  
set rowcount 0
set nocount off
end

建一個視窗W_MAIN,視窗上只有一個空的DW,一個按鈕,一個SLE用於輸入第一個參數。
按鈕內代碼:


string ERRORS, sql_syntax
string presentation_str, dwsyntax_str

sql_syntax = "execute get_shortmsg '"+sle_1.text+"','第二個參數'"
presentation_str = "style(type=grid)"
dwsyntax_str = SQLCA.SyntaxFromSQL(sql_syntax, &
   presentation_str, ERRORS)

IF Len(ERRORS) > 0 THEN
   MessageBox("Caution", &
   "SyntaxFromSQL caused these errors: " + ERRORS)
   RETURN
END IF

dw_1.Create( dwsyntax_str, ERRORS)

IF Len(ERRORS) > 0 THEN
   MessageBox("Caution", &
      "Create cause these errors: " + ERRORS)
   RETURN
END IF
dw_1.settransobject(sqlca)
dw_1.retrieve()

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.