现在有一个包: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
其中第四个参数 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
应该是个Oracle数据库吧你那个自定义类型在数据库里是啥样的?
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();
}
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
ERROR [42000] [Oracle][ODBC][Ora]ORA-00900: 无效 SQL 语句
type, spatial included. Generally, Microsoft protocols like ADO don't
provide support for Oracle specific types & constructs. Flat the member variables as parameters.
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.
这位老大说的什么意思?
"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");
OdbcCommand cmd;
OdbcDataReader reader;