所以我的代码看起来像 -
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace OraDateTest {
public partial class _Default: System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
OracleDate testdate1 = new OracleDate();
String newdate = String.Format("{0:dd-MMM-yy}", DateTime.Parse("1/1/2001"));
OracleDate testdate2 = new OracleDate(newdate);
}
}
}
testdate1实例化得很好。
但是,testdate2会抛出此错误。
[DllNotFoundException: Unable to load DLL 'OraOps11w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
Oracle.DataAccess.Types.OpsDat.AllocValCtxFromData(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second, OpoDatValCtx*& ctx) +0
Oracle.DataAccess.Types.OpoDatCtx..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second) +190
Oracle.DataAccess.Types.OracleDate..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second) +237
Oracle.DataAccess.Types.OracleDate..cctor() +64
[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Types.OracleDate' threw an exception.]
Oracle.DataAccess.Types.OracleDate..ctor(DateTime data) +23
OraDateTest._Default.Page_Load(Object sender, EventArgs e) in c:\users\jonesmi\documents\visual studio 2010\Projects\OraDateTest\OraDateTest\Default.aspx.cs:14
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
如果它真的找不到'OraOps11w.dll',我不会在两个实例上都出错吗?我的dll可能已经过时了吗?
答案 0 :(得分:0)
Unzip all the JAR's in zip file of odt.net you downloaded
Get all the files inside that you just unzipped:
oci.dll (renamed from 'oci.dll.dbl')
Oracle.DataAccess.dll
oraociicus11.dll
OraOps11w.dll
orannzsbb11.dll
oraocci11.dll
ociw32.dll (renamed from 'ociw32.dll.dbl')
Copy all the dll files into the bin dir of your .net exe