一个存储过程为3个输入参数,1个输出游标
前台的程序为:
string sql = "{call PKG_DA0100C.P_REFER('" + Convert.ToString(txt_mat_no.Text) + "','" + Convert.ToString(txt_pysx.Text) + "','" + Convert.ToString(txt_specandtype.Text) + "')}";
DataSet ds1 = DbHelperOra.Query(sql.Trim());
DbHelperOra.Query()函数:
1 public static DataSet Query(string SQLString)
2 {
3 using (OracleConnection connection = new OracleConnection(connectionString))
4 {
5 DataSet ds = new DataSet();
6 try
7 {
8 connection.Open();
9 OracleDataAdapter da = new OracleDataAdapter(SQLString, connection);
10 da.Fill(ds,"ds");
11 }
12 catch(System.Data.OracleClient.OracleException ex)
13 {
14 throw new Exception(ex.Message);
15 }
16 return ds;
17 }
18 }
运行时SQLString为 {call PKG_DA0100C.P_REFER('','','')} 提示无效字符
如果SQLString赋值时去掉两边的大括号,则提示 输入参数或类型不正确。请高手解答!
用OracleCommand+OracleParameter来做吧。