2012-02-27 212 views
0

所以我的代碼看起來像 -實例化對象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可能過時了嗎?

+0

你可以嘗試升級到odp.net 11.2,並嘗試看看是否可行或驗證,你現在確實有與Xcopy的ODP.NET附帶的文件MSVCR71.DLL和mfc71.dll。 – 2012-02-27 20:38:30

+0

我正在使用ODP.net 11.2。另外我有msvcr71,版本7.10.3052.4,mfc71.dll,版本7.10.3077.0。 – duckmike 2012-02-27 20:45:16

回答

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 
+0

我將所有這些DLL複製到我的.exe文件夾中,但它仍然無法工作。 – duckmike 2012-02-27 20:54:02

+0

嘗試從項目中刪除您的參考並再次添加。請嘗試將Oracle.DataAccess.dll放在與上述其他文件相同的bin目錄中。 – 2012-02-27 20:56:18

+0

沒有。仍然不起作用。 – duckmike 2012-02-27 21:01:08