Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.TyepInitialization.Exception w ado.net connection

Status
Not open for further replies.

Fig000

Programmer
Jun 13, 2001
12
0
0
US
I've written a small app that worked fine on my laptop. The laptop is running windows 2000 with the .net framwork and development environment installed. I moved the exe and pdb generated by the build to one of our servers. This server has the .net framework on it. For some reason when I run it on this server I get the following error:

An exception 'System.TyepInitialization.Exception' has occurred in Myprogram.exe


The app did a number of things but, for the sake of debugging this problem, I've stripped eveything else out. All I have now is a public sub main with nothing in it and a global declartion at the top of the module:

Dim myConnection As New System.Data.OleDb.OleDbConnection()

That's all. If this declaration in there it causes the error. If it is commented out, the program runs (though it doesn't do anything).

We have other exe's running on this same server that also declare a New System.Data.OleDb.OleDbConnection() and they work fine. I added the adodb reference but the problem is still there. Any suggestions?

Thanks,
Neil

 

The OleDbConnection object expects a parameter connectionString As String. Where and how are you passing it??? Try something like this

Dim strConn As String
Dim Conn As OleDbConnection

'Build the Connection strings.
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\Microsoft Visual Studio\VB98\NWIND.mdb"

'Pass the Connection string to OleDbConnection object.
Conn = New OleDbConnection(strConn)

 
Thanks for answering everyone.

I can't remove the brackets-it puts them back in when I change lines in the development screen.

I should make it clear: This program worked perfectly on another machine; it is on our intranet server that it isn't working.

I stipped out all the code except for the declaration to see what was causing the error. I am not using the connection variable, just declaring it which I should be able to do, even if I don't use it. It is the presence of this declaration that causes the error. Obviously it can't instantiate it and, from my looking at user groups on the web, it seems that it might be some assembly element not on our intranet server. I can't figure out what it is and, oddly, another program using this type of declaration works fine. (I've looked in that program and can't find anything to explain this).

Thanks,
Neil
 
Baddos,

Both PCs are running version 1.0.3705

Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top