你最好还是把你的编码贴出来,注意ORACLE要用 SELECT * FROM Customers WHERE CustomerID = :pCustomerIDmyDataAdapter.SelectCommand.Parameters.Add("pCustomerID", OracleType.VarChar, 80).Value = "Smith";

解决方案 »

  1.   

    下面的代码但是用OracleClient时就说这样的错误+ System.SystemException {"ORA-06550: 第 1 行, 第 7 列: 
    PLS-00306: 调用 'GETROWID' 时参数数量或类型错误
    ORA-06550: 第 1 行, 第 7 列: 
    PL/SQL: Statement ignored
    "} System.SystemException你应该遇到过,帮忙看看是怎么回事?谢谢。下面是代码。到底那一个地方有误啊/// < summary> 
    /// 根据传入的表的代码,返回新的行号
    /// < /summary> 
    /// < param name="sTypeCode"> 要取行号的表代码< /param> 
    /// < returns> 返回的指定表的新行号< /returns> 
    public string GetRowID(string sTableCode)
    {
    string sRowId = "";
    try
    {
    IDbDataParameter[] oPara =this.NewDBDataParameter(2);//申请空间及赋予对应类型的参数对象oPara[0].ParameterName=":sTableCode";
    oPara[0].DbType=DbType.AnsiString;
    //oPara[0].DbType=OracleType.VarChar
    oPara[0].Value = sTableCode;
    oPara[0].Direction=ParameterDirection.Input;oPara[1].ParameterName=":sRowId";
    oPara[1].DbType=DbType.AnsiString;
    oPara[1].Direction = ParameterDirection.Output;
    oPara[1].Size=32;IDataParameterCollection oParaCollection = ExecuteSpPara("getrowid",oPara);
    sRowId = ((IDataParameter)oParaCollection["sRowId"]).Value.ToString();
    }
    catch(Exception e)
    {
    Log.WriteLog("System","GetRowID" ,"取表[" + sTableCode + "]的记录行号出错!出错信息是:" + e.ToString());
    sRowId = "";
    }return(sRowId);
    }/// < summary> 
    /// 执行一个存储过程,并返回相应的参数集合
    /// < /summary> 
    /// < param name="sProcName"> 存储过程名称< /param> 
    /// < param name="oInPara"> 存储过程传入参数< /param> 
    /// < returns> 存储过程返回参数集合< /returns> 
    public IDataParameterCollection ExecuteSpPara(string sProcName,IDbDataParameter[] oInPara)
    {
    IDbCommand IDbCmd=this.NewDBCommand();
    IDbConnection IDbConn=null;
    if(this.LongDbConn==null)
    {//如果存在长连接,则使用长连接,否则根据连接参数建立新的连接。
    IDbConn=NewDBConnection();
    IDbConn.Open();
    }
    else
    {
    IDbConn=this.LongDbConn;

    IDbCmd.CommandType=CommandType.StoredProcedure;
    IDbCmd.CommandText=sProcName;
    IDbCmd.Connection=IDbConn;
    for(int i=0; i< oInPara.Length;i++)
    {
    IDbCmd.Parameters.Add(oInPara[i]);
    }try
    {
    IDbCmd.ExecuteNonQuery();
    }
    catch(System.Data.OracleClient.OracleException oe)
    {
    Log.WriteLog("System",this.ToString(),oe.ToString());
    }
    catch(Exception e)
    {
    Log.WriteLog("System",this.ToString(),e.Message);
    }
    if(IDbConn!=null && ! IDbConn.Equals(this.LongDbConn) && IDbConn.State==ConnectionState.Open)
    {
    IDbConn.Close();
    }
    return IDbCmd.Parameters;
    } create or replace procedure getrowid(as_table_code IN VARCHAR2,as_row_id OUT VARCHAR2) IS
      ld_value NUMBER;
      ld_year number(4);
      ld_month number(2);
      ld_day number(2);
      ls_code_param varchar2(2);
    BEGIN
      

  2.   

    try to remove ":" from the parameter name and make sure the parameter name matches what is in the sp
      

  3.   

    真不好意思,那个冒号我是看别的地方要加什么冒号我就加上,本来没有的,没有也不对,刚才我有试了一下,用MSDAORA.1还是成功(没有冒号的)。我想应该是通用的。
    我担心的DbType不对,但又似乎不可能,ProgName是不是要用getrowid(:sTableCode,:sRowId),但我试了还不对,按理来说,我用的都是Ixxx接口来访问,对象类具体的实例是对应的派生类(OracleClient),不会错的,最让我不解的是换用Oledb驱动,用OleDb控件的类就正确。可是一样的代码啊
      

  4.   

    我得Oracle版本是 8.1.6.0.0 会不会有影响啊
      

  5.   

    have you tried?oPara[0].ParameterName="as_table_code";
    ....
    oPara[1].ParameterName="as_row_id";