Проблема с кодом VB.NET
Где у меня есть проблема, пожалуйста? Иногда приложение показывает мне ошибку с этим текстовым сообщением.
Спасибо
************** Text výjimky ************** System.Data.OleDb.OleDbException (0x80004005): Nespecifikovaná chyba v System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) v System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) v System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) v System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) v System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) v System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) v System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) v System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) v System.Data.OleDb.OleDbConnection.Open() v LSiMontix.Log.updatelog() v C:\Users\cahafi\Desktop\V2-Solution2\WindowsApplication17\WindowsApplication17\Log.vb:řádek 102 v LSiMontix.iMontix.Button1_Click(Object sender, EventArgs e) v C:\Users\cahafi\Desktop\V2-Solution2\WindowsApplication17\WindowsApplication17\Form.vb:řádek 537 v System.Windows.Forms.Control.OnClick(EventArgs e) v System.Windows.Forms.Button.OnClick(EventArgs e) v System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) v System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) v System.Windows.Forms.Control.WndProc(Message& m) v System.Windows.Forms.ButtonBase.WndProc(Message& m) v System.Windows.Forms.Button.WndProc(Message& m) v System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) v System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) v System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Načtená sestavení ************** mscorlib Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- iMontix Verze sestavení: 1.0.0.0 Verze Win32: 1.0.0.0 Základ kódu (CodeBase): file:///C:/Users/Balen%C3%AD%20NH/Desktop/Debug/iMontix.exe ---------------------------------------- Microsoft.VisualBasic Verze sestavení: 10.0.0.0 Verze Win32: 14.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll ---------------------------------------- System Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Core Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- System.Windows.Forms Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Configuration Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Xml Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- System.Runtime.Remoting Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll ---------------------------------------- System.Data Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll ---------------------------------------- System.Data.resources Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.resources/v4.0_4.0.0.0_cs_b77a5c561934e089/System.Data.resources.dll ---------------------------------------- System.Windows.Forms.resources Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_cs_b77a5c561934e089/System.Windows.Forms.resources.dll ---------------------------------------- System.Data.DataSetExtensions Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll ---------------------------------------- System.Numerics Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll ---------------------------------------- mscorlib.resources Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_cs_b77a5c561934e089/mscorlib.resources.dll ---------------------------------------- Accessibility Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll ---------------------------------------- System.Transactions Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3163.0 built by: NET472REL1LAST_C Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll ---------------------------------------- System.EnterpriseServices Verze sestavení: 4.0.0.0 Verze Win32: 4.7.3062.0 built by: NET472REL1 Základ kódu (CodeBase): file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll ---------------------------------------- ************** Ladění JIT ************** Aby bylo povoleno ladění JIT, musí konfigurační soubor pro tuto aplikaci nebo počítač (machine.config) mít v oddílu system.windows.forms nastavenou hodnotu njitDebugging. Aplikace rovněž musí být kompilována s povoleným laděním. Příklad: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> Je-li ladění JIT povoleno, budou všechny neošetřené výjimky odeslány ladicímu programu JIT, který je registrován v počítači, a nebudou zpracovány tímto dialogovým oknem.
Что я уже пробовал:
Я не знаю, что случилось. ..........................
вот мой код:
Public Shared Sub updatelog() Dim formattedDate As String = Date.Today.ToString("dd/MM/yyyy") Dim OnlyTime As String = DateTime.Now.ToString("HH:mm:ss") Dim cislod As String Dim zakazc As String Dim stav As String Dim ID = iMontix.TextBox6.Text Dim kod_operace = iMontix.TextBox8.Text Dim smena = iMontix.TextBox5.Text Dim provider As String Dim dataFile As String Dim connString As String Dim myConnection As OleDbConnection = New OleDbConnection cislod = iMontix.TextBox1.Text zakazc = iMontix.TextBox2.Text stav = "OK" provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" dataFile = "sdf.accdb" ' Change it to your Access Database location connString = provider & dataFile myConnection.ConnectionString = connString myConnection.Open() Dim str As String str = "INSERT INTO Log ([Číslo dílu], [Zákaznické číslo], [Výsledek], [Datum], [Čas], [ID], [Směna], [Kód operace]) values('" & cislod & "','" & zakazc & "','" & stav & "','" & formattedDate & "','" & OnlyTime & "','" & ID & "','" & smena & "','" & kod_operace & "')" Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection) cmd.Parameters.Add(New OleDbParameter("Číslo dílu", CType(cislod, String))) cmd.Parameters.Add(New OleDbParameter("Zákaznické číslo", CType(zakazc, String))) cmd.Parameters.Add(New OleDbParameter("Výsledek", CType(stav, String))) cmd.Parameters.Add(New OleDbParameter("Datum", CType(formattedDate, String))) cmd.Parameters.Add(New OleDbParameter("Čas", CType(OnlyTime, String))) cmd.Parameters.Add(New OleDbParameter("ID", CType(ID, String))) cmd.Parameters.Add(New OleDbParameter("Směna", CType(smena, String))) cmd.Parameters.Add(New OleDbParameter("Kód operace", CType(kod_operace, String))) cmd.ExecuteNonQuery() cmd.Dispose() myConnection.Close() End Sub