Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-02-2009
Member
 
Join Date: Jan 2009
Posts: 36
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
Reply With Quote
  #2  
Old 03-02-2009
Member
 
Join Date: Jan 2009
Posts: 44
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.
Reply With Quote
  #3  
Old 03-02-2009
Member
 
Join Date: Jan 2009
Posts: 36
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!
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "The type initializer give me an error"
Thread Thread Starter Forum Replies Last Post
HTC Sense give 404 error in HTC Sensation XL Bishwajeet Portable Devices 4 29-11-2011 01:44 AM
my BSNL card give the error 619 while connecting to the internet feNRE123 India BroadBand 4 20-03-2011 03:25 AM
Call of Duty: Black ops 3D Vision give error Raveroy Video Games 4 08-12-2010 10:40 AM
Certain Websites give error in Mozilla firefox Adikavi Technology & Internet 4 02-03-2010 08:13 AM
Windows Update Website Give Error message ABBOTT Technology & Internet 3 03-03-2009 07:19 PM


All times are GMT +5.5. The time now is 03:29 AM.