所以我的代碼看起來像 -實例化對象OracleDate
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可能過時了嗎?
你可以嘗試升級到odp.net 11.2,並嘗試看看是否可行或驗證,你現在確實有與Xcopy的ODP.NET附帶的文件MSVCR71.DLL和mfc71.dll。 – 2012-02-27 20:38:30
我正在使用ODP.net 11.2。另外我有msvcr71,版本7.10.3052.4,mfc71.dll,版本7.10.3077.0。 – duckmike 2012-02-27 20:45:16