C# .net 寫完Program, 過機唔得

本帖最後由 56981 於 2011-10-10 13:13 編輯

原先用oracle client 8I, 搬新機去一部電腦用oracle client 9I
就系Run 唔到

個Program 用OleDB 連去Oracle, 如下:
出現下面P3 張圖的error , 而原先8I部機個Program咩事都無
        public void connection(string atext)
        {
                string connectionString = "provider=MSDAORA;data source=CPCS_UAT;user id=KYPUN;password=fatboy";
                OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);

                OleDbCommand myOleDbCommand = myOleDbConnection.CreateCommand();

                myOleDbCommand.CommandText = atext;

                myOleDbConnection.Open();
                OleDbDataReader myOleDbDataReader = myOleDbCommand.ExecuteReader();

                    if (String.IsNullOrEmpty(myOleDbDataReader["APP"].ToString()) == false)
                        APP[count] = myOleDbDataReader["APP"].ToString();
                    else if (String.IsNullOrEmpty(myOleDbDataReader["APP"].ToString()) == true)
                        APP[count] = " ";
               
                myOleDbConnection.Close();
        }




圖p3 error 的detail

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.OleDb.OleDbException: Oracle error occurred, but error message could not be retrieved from Oracle.
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at NBIS.Form1.connection1(String atext) in C:\Documents and Settings\ACPMS_001\Desktop\NBIS\NBIS\Form1.cs:line 96
   at NBIS.Form1.button6_Click(Object sender, EventArgs e) in C:\Documents and Settings\ACPMS_001\Desktop\NBIS\NBIS\Form1.cs:line 1703
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
NBIS
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Documents%20and%20Settings/ACPMS_001/Desktop/NBIS/NBIS/bin/Debug/NBIS.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

去p3.png 個details 睇下係乜先啦~~~其實個program 係咪你寫?
一個有經驗programmer 唔會咁問法

TOP

你依個error...明顯係publish左後o既error message...你就咁問係冇人答得到你...

TOP

本帖最後由 56981 於 2011-10-9 18:19 編輯

個program 係我寫, 我是自學半桶水, 而且一人project, 3000行左右, 所以咩都run到就算, 又問過幾個senior 都無人搞掂到. 要等星期一返到公司再貼上來, 所以想請網上咁多位師兄幫手

個error 系Visual Studio 度publish, 再彈出來

TOP

.....你開個debug mode 睇睇咩事先....
因為就咁睇 , 我地都唔知咩事~ p3. 只係話有exception 係你run program 時, 而你又無try catch 到咁樣, 詳細要看看detail.

如果個program 係你寫, 你用用個vs run program 去9i 先 , 再落部機到...
做多一點testing

TOP

sorry 我講得唔清楚
系click button6 然後連去上面的method "connection" (用OleDB)

TOP

你9I部機有冇個datasource呀??

TOP

Just curious....why not use ODAC?
http://www.oracle.com/technetwor ... ownloads/index.html

However, I am not sure if 11g ODAC is compatible with 9i DB

TOP

感謝師兄/姐, 留言

datasource 是指 tnsnames.ora嗎, 有
我用oracle toad 可以run 到table出來

------------------------------------------
11g
因為我本身用8i寫, 後尾過機先發現部門內, 部部機都唔同, 老細部機用9i, 而部腦又用緊好多其他自製陳年system
一轉11g, 我怕大獲
所以想系9i 搞番好

TOP