2011-12-14 94 views
0

我有下面的SQL正在執行與OleDBConnection和OleDBCommand和它永遠和最終超時,我不知道爲什麼。在執行這個腳本之前,別人會被執行,並且他們沒事。我不知道這個有什麼特別之處。Oracle簡單INSERT語句花費時間

begin 
     insert into messages (message_id,message,store_in_log, message_group) 
     values (25000,'Production Floor','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25001,'Building 4 – A','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25002,'Building 3 – A','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25003,'Building 4 – B','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25004,'Building 4 – C','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25005,'Building 4 – D','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25006,'Quarantine','False','Locations'); 
     insert into messages (message_id,message,store_in_log, message_group) 
      values (25007,'Small Area','False','Locations'); 
end; 

VB代碼OLEDB連接:

 Dim sc As Script 
     Dim C As New OleDb.OleDbConnection(CnStr) 
     Dim Cmd As OleDb.OleDbCommand 
     Dim sql As String 
     For Each sc In s    
     sql = sc.OracleScript    

     Cmd = New OleDb.OleDbCommand(sql, C) 
     Try 
      Cmd.Connection.Open() 
      Cmd.ExecuteNonQuery() 
     Catch ex As Exception 

     Finally 
      Cmd.Connection.Close() 
      Cmd.Dispose() 
      Cmd = Nothing 
     End Try 

     Next 
+0

你可以顯示你的.NET/C#代碼在哪裏打開連接並執行OleDbCommand?你爲什麼要連接OleDb而不是與Oracle本地客戶端連接的任何原因? – 2011-12-14 11:13:46

+0

你有`store_in_log`或`message_group`上的索引嗎?表中有多少數據? – Thilo 2011-12-14 11:14:09

回答