The type initializer give me an error
Hi,
I am trying to open an OleDb connection for access it gives me the following error.
The type initializer for
'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception.
Code:
Private Sub OpenConnection()
If _connection Is Nothing Then
_connection = New OleDb.OleDbConnection(_connStr)
_connection.Open()
Else
If _connection.State = ConnectionState.Open Then
Else
_connection.Open()<------- ERRROR HERE
End If
End If
End Sub
Re: The type initializer give me an error
Well i think you are getting confused with the concept of ADO.NET
Since you are opening the connection but not closing it.
You are trying to open the connection which is already open.
Try
Connection.Closed()
I think this is your problem.
Re: The type initializer give me an error
Thanks for the help I think my code is wrong!
I need to do this other way!