[英]ORA-00900: invalid SQL statement while filling DataAdapter with Dataset. C# ASP.net
I am using VS'12 ASP.net 4.5 and oracle 10.2.0.1 我正在使用VS'12 ASP.net 4.5和oracle 10.2.0.1
Here is my code where exception arises. 这是我的代码中出现异常的地方。
Agreement agreement = null;
using (OracleConnection MyConn = new BaseRepository().GetConnection())
{
MyConn.Open();
OracleCommand commOracle = new OracleCommand("PACKAGE_AGREEMENT.USP_GET_AGREEMENT_BY_ID", MyConn);
VendorRepository vendorRepository = new VendorRepository();
commOracle.Parameters.Add("SP_AGREEMENT_ID", OracleDbType.Int32, Agreementid, System.Data.ParameterDirection.Input);
commOracle.Parameters.Add("SP_CUR_AGREEMENT", OracleDbType.RefCursor, ParameterDirection.Output);
OracleDataAdapter daOracle = new OracleDataAdapter(commOracle);
DataSet dsOracle = new DataSet();
daOracle.Fill(dsOracle);//Here the exception arises.
if (dsOracle.Tables[0].Rows[0] != null)
{
DataRow row = dsOracle.Tables[0].Rows[0];
agreement = new Agreement();
agreement.pkAgreementId = Convert.ToInt32(row["pkAgreementId"]);
agreement.Vendor = vendorRepository.GetById(Convert.ToInt32(row["fkVendorId"]));
agreement.IsActive = row["IsActive"].ToString() == "N" ? false : true;
agreement.IsDeleted = row["IsDeleted"].ToString() == "N" ? false : true;
agreement.RentalAmount = Convert.ToInt32(row["RentalAmount"]);
agreement.VehicleCost = Convert.ToInt32(row["VehicleCost"]);
agreement.DateOfAgreement = Convert.ToDateTime(row["DateOfAgreement"]);
agreement.DateCreated = Convert.ToDateTime(row["DateCreated"]);
agreement.DateModified = Convert.ToDateTime(row["DateModified"]);
}
}
My Package PACKAGE_AGREEMNET specification: 我的软件包PACKAGE_AGREEMNET规范:
create or replace PACKAGE PACKAGE_AGREEMENT AS TYPE REF_CURSOR IS REF CURSOR; PROCEDURE USP_GET_AGREEMENT_BY_ID(SP_AGREEMENT_ID IN NUMBER, SP_CUR_AGREEMENT OUT REF_CURSOR); END PACKAGE_AGREEMENT;
Package body : 包装体:
create or replace PACKAGE BODY PACKAGE_AGREEMENT AS PROCEDURE USP_GET_AGREEMENT_BY_ID(SP_AGREEMENT_ID IN NUMBER, SP_CUR_AGREEMENT OUT REF_CURSOR) IS BEGIN OPEN SP_CUR_AGREEMENT FOR SELECT "Agreement".*, ora_rowscn as TimeStamp FROM "Agreement" WHERE "pkAgreementId" = SP_AGREEMENT_ID AND "IsDeleted" = 'N'; END USP_GET_AGREEMENT_BY_ID; END PACKAGE_AGREEMENT;
Now if I run the package in the visual studio (data connections). 现在,如果我在Visual Studio中运行程序包(数据连接)。 it compiles with no errors and no warnings. 它编译没有错误,也没有警告。 I don't know where the problem is. 我不知道问题出在哪里。
Please help. 请帮忙。
Thanks in advance. 提前致谢。
您是否在执行命令之前先设置了命令类型?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.