Dear all,
First of all I want to say that I am not a programmer at all. From time to time a have used VB6.0. At the moment I am writing a program in VB.net which basicly reads some data calculates lot of numbers and gives an output. This last part gives me troubles.
I have constructed a datatable with the code. Now I want to put this table into access using the following code:
The open_connection and close_connection are other procedures with following code:
dtOutputtable is declared as a datatable
The program stops at the ExecuteNonQuery statement with the following message:
What do I wrong?
First of all I want to say that I am not a programmer at all. From time to time a have used VB6.0. At the moment I am writing a program in VB.net which basicly reads some data calculates lot of numbers and gives an output. This last part gives me troubles.
I have constructed a datatable with the code. Now I want to put this table into access using the following code:
VB.NET:
Public Sub writeoutputtable()
Dim sSQL As String
open_connection(database)
sSQL = "Select dtOutputtable.* INTO " & Outputtablename & " FROM dtOutputtable"
cmdupdate = New OleDbCommand(sSQL, cndatabase)
cmdupdate.ExecuteNonQuery()
close_connection(database)
End Sub
The open_connection and close_connection are other procedures with following code:
VB.NET:
Public Sub open_connection(ByVal database As String)
Dim sconnexion As String
sconnexion = "Provider=Microsoft.Jet.OLEDB.4.0;"
sconnexion &= "Password=;User ID=Admin;"
sconnexion &= "Data Source=" & database
cndatabase = New OleDbConnection(sconnexion)
Try
cndatabase.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub close_connection(ByVal database As String)
Try
cndatabase.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
The program stops at the ExecuteNonQuery statement with the following message:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
What do I wrong?
Last edited by a moderator: