Error while executing sp from c# against Oracle database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Error while executing SP

    #1

    Error while executing sp from c# against Oracle database

    Hi,
    I am getting "Unspecifie d error"

    using(System.Da ta.OleDb.OleDbC onnection cn = new System.Data.Ole Db.OleDbConnect ion())
    {
    cn.ConnectionSt ring="Provider= OraOLEDB.Oracle ;Password=STORE D_OBJ;User ID=STORED_OBJ;D ata Source=PDCDGL1. NA.HPFS.COM;Ext ended Properties=;Per sist Security Info=False;PLSQ LRSet=1;";
    cn.Open();

    //String strProcName = "{CALL pkg_product.Sea rchProd(?, ?, ?, ?, ?, ?, {resultset 0, CDFCursor})}";

    String strProcName = "{CALL pkg_product.Sea rchProd(?, ?, ?, ?, ?, ?}}";
    System.Data.Ole Db.OleDbCommand cmd = new System.Data.Ole Db.OleDbCommand ();
    cmd.Connection = cn;
    cmd.CommandText =strProcName;
    cmd.CommandType =CommandType.Te xt;
    cmd.Parameters. Add("mfrid",Sys tem.Data.OleDb. OleDbType.Integ er).Value=3;
    cmd.Parameters. Add("prodtypeid ",System.Data.O leDb.OleDbType. Integer).Value= 1;
    cmd.Parameters. Add("partnum",S ystem.Data.OleD b.OleDbType.Var WChar).Value=3;
    cmd.Parameters. Add("descr",Sys tem.Data.OleDb. OleDbType.VarWC har).Value="3";
    cmd.Parameters. Add("active",Sy stem.Data.OleDb .OleDbType.VarW Char).Value="3" ;
    cmd.Parameters. Add("langcode", System.Data.Ole Db.OleDbType.Va rWChar).Value=" 3";

    //cmd.Parameters. Add("CDFCursor" ,System.Data.Ol eDb.OleDbType.V arWChar).Value= "";

    cmd.ExecuteRead er();

    cn.Close();
    }


    PROCEDURE SearchProd ( mfrid in number,prodtype id in number,partnum in varchar2,descr in nvarchar2,
    active in varchar2, langcode in varchar2,CDFCur sor in out CDFCur)
    Is
    langcd varchar2(3);
    begin
    if langcode = ' ' then
    langcd := 'eng';
    else
    langcd := langcode;
    end if;

    if langcd = 'eng' then
    Open CDFCursor for
    Select (to_char(pr.pro duct_id) || '|' || langcd) primkey, mf.mfr_short_na me mfr_short_name,
    pr.part_number part_number, pr.short_desc short_descr,
    langcd langcd, pt.product_type _value,
    decode(ltrim(rt rim(pr.active_s tatus_ind)),'Y' ,-1,0) active_status_i nd
    from product pr,manufacturer mf,product_type pt
    where pr.mfr_id = mf.mfr_id and
    pr.product_type _id = pt.product_type _id
    and (pr.mfr_id = mfrid or mfrid = -1 )
    and (pr.product_typ e_id = prodtypeid or prodtypeid = -1)
    and (upper(pr.part_ number) like upper(partnum) or partnum = ' ' or partnum is null )
    and (upper(pr.short _desc) like upper(descr) or descr = ' ' or descr is null )
    and (upper(ltrim(rt rim(pr.active_s tatus_ind))) = upper(active) or active = ' ' or active is null );
    else
    Open CDFCursor for
    Select distinct (to_char(pr.pro duct_id) || '|' || langcd) primkey,ml.mfr_ short_name mfr_short_name,
    pl.part_number part_number, pl.short_descr short_descr,
    pl.lang_cd lang_cd, pt.product_type _value,
    decode(ltrim(rt rim(pr.active_s tatus_ind)),'Y' ,-1,0) active_status_i nd
    from product pr,manufacturer mf,product_type pt,product_lang pl, mfr_lang ml
    where pr.product_type _id = pt.product_type _id
    and pr.product_id = pl.product_id
    and pl.lang_cd = langcd
    and pr.mfr_id = ml.mfr_id (+)
    and ml.lang_cd (+) = langcd
    and (pr.mfr_id = mfrid or mfrid = -1 )
    and (pr.product_typ e_id = prodtypeid or prodtypeid = -1)
    and (upper(pr.part_ number) like upper(partnum) or partnum = ' ' or partnum is null )
    and (upper(pl.short _descr) like upper(descr) or descr = ' ' or descr is null )
    and (upper(ltrim(rt rim(pr.active_s tatus_ind))) = upper(active) or active = ' ' or active is null );
    end if;

    end SearchProd ;

Working...