怎麼呼叫儲存過程和函式?

2022-03-29 08:37:58 字數 2364 閱讀 1495

1.增加操作:

public static void stockins(string ps_suppliername, int pn_itemqty, string ps_itemdesc, string ps_comedate,

string ps_attachedfile, string ps_supaddress, string ps_supphone, string ps_supfax,

string ps_supemail, string ps_userno, ref string ps_hkstockitemno)

;// 給引數賦值

parms[0].value = ps_suppliername;

parms[1].value = pn_itemqty;

parms[2].value = ps_itemdesc;

parms[3].value = ps_comedate;

parms[4].value = ps_attachedfile;

parms[5].value = ps_supaddress;

parms[6].value = ps_supphone;

parms[7].value = ps_supfax;

parms[8].value = ps_supemail;

parms[9].value = ps_userno;

orahelper.executenonquery(orahelper.connstr, commandtype.storedprocedure, "kxscmiii.pkg_pu_hkstock.pro_stockins", parms);

ps_hkstockitemno = parms[10].value.tostring(); // 返回存貨單號

}在前台*.aspx.cs檔案裡面呼叫:

string strbill = "";

hkstockdataaccess.stockins(txtsuppliername.text.trim(), int32.parse(txtitemqty.text.trim()), txtitemdesc.text.trim(),

txtcomedate.text.trim(), strserverfullpath, txtsupaddress.text.trim(), txtsupphone.text.trim(),

txtsupfax.text.trim(), txtsupemail.text.trim(), session["userno"].tostring(),ref strbill);

2.修改操作:

public static void claimstock(string ps_hkstockitemno, string ps_buyer,

string ps_delino, string ps_userno)

;// 給引數賦值

parms[0].value = ps_hkstockitemno;

parms[1].value = ps_buyer;

parms[2].value = ps_delino;

parms[3].value = ps_userno;

orahelper.executenonquery(orahelper.connstr, commandtype.storedprocedure, "kxscmiii.pkg_pu_hkstock.pro_claimstock", parms);

}3.查詢操作:

public static datatable stockdetailget(string ps_hkstockitemno)

;// 給引數賦值

parms[0].value = ps_hkstockitemno;

// 取記錄集

dataset ds = orahelper.executedataset(orahelper.connstr, commandtype.storedprocedure,

"kxscmiii.pkg_pu_hkstock.pro_stockdetailget", parms);

return ds.tables[0];

}4.呼叫函式:

public static string buyernameget(string ps_cardno)

;// 給引數賦值

parms[0].value = ps_cardno;

orahelper.executenonquery(orahelper.connstr, commandtype.storedprocedure, "kxscmiii.pkg_pu_hkstock.fun_buyernameget", parms);

return parms[1].value.tostring(); // 返回業務員的中文名

}

OTL呼叫儲存過程和函式

otl簡單介紹 oracle 儲存函式 func test create or replace function func test a in integer,b in out integer,c out integer return integer isd integer begin c 10 b...

MySQL呼叫儲存過程和函式

儲存過程和函式有多種呼叫方法。儲存過程必須使用call語句呼叫,並且儲存過程和資料庫相關,如果要執行其他資料庫中的儲存過程,需要指定資料庫名稱。例如call dbname.procname。儲存函式的呼叫與mysql中預定義的函式的呼叫方式相同。1.呼叫儲存過程 儲存過程是通過call 語句進行呼叫...

SQL儲存過程呼叫標量值函式,儲存過程呼叫儲存過程

一 存 儲過程呼叫標量值函式 先建乙個標量值函式,如 create function dbo f num a nvarchar 50 returns nvarchar 50 asbegin declare m nvarchar 50 select m a aad return m end接下來 在儲...