现在有一个包:Qmap_getlocationPkg包里有个过程:PROCEDURE Qmap_getlocation(dest_coord_x int,dest_coord_y int,searchchType int, p_rc OUT myrctype) 
其中第四个参数 p_rc OUT myrctype 是自定义的类型我现在要调用这个过程,主要代码如下: cmd.CommandText = "{call Qmap_getLocation(?,?,?,?)}";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Prepare(); cmd.Parameters.Add("@dest_coord_x",OdbcType.Int);
cmd.Parameters.Add("@dest_coord_y",OdbcType.Int);
cmd.Parameters.Add("@searchchType",OdbcType.Int);
cmd.Parameters.Add("@p_rc",???);<---这里自定义的参数该写什么类型? cmd.Parameters["@dest_coord_x"].Value = int.Parse(xpos.Value);
cmd.Parameters["@dest_coord_y"].Value = int.Parse(ypos.Value);
cmd.Parameters["@searchchType"].Value = -1;
cmd.Parameters["@p_rc"].Direction = ParameterDirection.Output; reader = cmd.ExecuteReader();问题1:代码这样写对不对?问题2:是否要Add第四个参数,自定义的类型该怎么写?问题3:cmd.CommandText应该写过程名还是写包的名字?
如果我写过程名,报这个错:
ERROR [HY000] [Oracle][ODBC][Ora]ORA-06550: 第 1 行, 第 7 列: PLS-00201: 必须说明标识符 'QMAP_GETLOCATION' ORA-06550: 第 1 行, 第 7 列: PL/SQL: Statement ignored 
如果写包的名字,就包这个错:
ERROR [HY000] [Oracle][ODBC][Ora]ORA-06550: 第 1 行, 第 7 列: PLS-00221: 'QMAP_GETLOCATIONPKG' 不是过程或尚未定义 ORA-06550: 第 1 行, 第 7 列: PL/SQL: Statement ignored 

解决方案 »

  1.   

    cmd.CommandText = "Qmap_getLocation";//这么写就成
    应该是个Oracle数据库吧你那个自定义类型在数据库里是啥样的?
      

  2.   

    OdbcType.Binary 尝试下这个看看好用不
      

  3.   

    如果想知道类型 我用sql数据库写了个 你改改
    using (SqlCommand cmd=new SqlCommand())
    {
    cmd.Connection=sqlConnection1;
    cmd.CommandText="DuplicateGetCompletion";
    cmd.CommandType=CommandType.StoredProcedure;
    sqlConnection1.Open();
    SqlCommandBuilder.DeriveParameters(cmd);

    foreach(SqlParameter sp in cmd.Parameters)
    {
    string a=sp.SqlDbType.ToString();
    a="";
    }
    sqlConnection1.Close();
    }
      

  4.   

    TYPE myrctype IS REF CURSOR;貌似是个cursor
      

  5.   

    手头有个asp的示例,这里只绑了三个参数,很奇怪,难道最后一个参数可以无视?cmd.CommandText="dbo.Qmap_GetLocation"
    cmd.CommandType=4
    cmd.prepared=true
    set param=cmd.CreateParameter("@dest_coord_x", 3, 1,4,xpos)
    cmd.Parameters.Append param
    set param=cmd.CreateParameter("@dest_coord_y", 3, 1,4,ypos)
    cmd.Parameters.Append param
    set param=Cmd.CreateParameter("@searchchType", 3, 1,4,-1)
    cmd.Parameters.Append param
    set rss=cmd.execute
      

  6.   

    如果直接写cmd.CommandText = "Qmap_getLocation";的话,报错:
    ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: 无效 SQL 语句 
      

  7.   

    I don't believe that ADO provides methods to return any sort of object 
    type, spatial included.  Generally, Microsoft protocols like ADO don't 
    provide support for Oracle specific types & constructs. Flat the member variables as parameters.
      

  8.   

    jiangsheng(蒋晟.Net[MVP]) ( ) 信誉:110  2006-8-24 7:45:43  得分: 0  
     
     
       
    I don't believe that ADO provides methods to return any sort of object 
    type, spatial included.  Generally, Microsoft protocols like ADO don't 
    provide support for Oracle specific types & constructs. Flat the member variables as parameters.
      
     
    这位老大说的什么意思?
      

  9.   

    ADO不支持.将成员变量在参数中传递.
      

  10.   

    OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" + 
                                                    "Integrated Security=SSPI;Initial Catalog=northwind");OleDbDataAdapter catDA = new OleDbDataAdapter("SELECT CategoryID, CategoryName FROM Categories", nwindConn);catDA.InsertCommand = new OleDbCommand("InsertCategory", nwindConn);
    catDA.InsertCommand.CommandType = CommandType.StoredProcedure;OleDbParameter myParm = catDA.InsertCommand.Parameters.Add("@RowCount", OleDbType.Integer);
    myParm.Direction = ParameterDirection.ReturnValue;catDA.InsertCommand.Parameters.Add("@CategoryName", OleDbType.Char, 15, "CategoryName");myParm = catDA.InsertCommand.Parameters.Add("@Identity", OleDbType.Integer, 0, "CategoryID");
    myParm.Direction = ParameterDirection.Output;DataSet catDS = new DataSet();
    catDA.Fill(catDS, "Categories");DataRow newRow = catDS.Tables["Categories"].NewRow();
    newRow["CategoryName"] = "New Category";
    catDS.Tables["Categories"].Rows.Add(newRow);catDA.Update(catDS, "Categories");
      

  11.   

    我用的是ODBCOdbcConnection con = new OdbcConnection(ConfigurationSettings.AppSettings["sODBC"]);
    OdbcCommand cmd;
    OdbcDataReader reader;