This is the second time I encounter this problem, and I have to
reinstall VS.NET last time, and seems like I still have to do the same
this time.
This happened when I try to create a OleDbConnection object, and set
the ConnectionString in the property window.
If you create a connection to MDB (Access) file, it's all fine, same
applies to sql. But I was trying to connect to an Excel file. It
somehow works once or twice (so I did get the connectionString
before), but it would fail....and unrecoverable at the moment. Here is
what happened:
When I create a new connection, the DataLink Dialog shows up and I
Enter all information required (Set to Jet 4.0, choose the Excel File,
and set Extended Property to "Excel 8.0"), when you click "OK", A new
DataLink Dialog (empty) popup at the same position. And if you refill
the data, when you click ok, the IDE will popup an error message
saying "Object Reference not set to an instance of an object." and
from now on, you cannot open the DataLink Dialog within the IDE (i.e.
whenever you want to click the button in the ConnectionString box, you
get "Object reference not set ..." error). This won't be fixed if you
restart the IDE, or restart the computer. It's the pointer point to
the DataLink Dialog messed up.
If you try to open a udl file outside of the IDE, like in window
explorer, the DataLink Dialog opens fine.
Oh, one more thing. Last time when this happened is about 2~3 weeks
ago and I was too frustrated about it so I can't remember clearly
would a reinstall fixes the problem. I have a vague memory that it
won't, I have to reinstall the whole OS!!! I am not sure of it, but
I'm going to reinstall VS.NET now. I'll keep you posted.
Best Regards to all VS developer accessing Excel File,
Homa Wong
Homa - 26 Aug 2003 02:51 GMT
My vague memory is indeed correct. I did a repair it doesn't work. And
I uninstall it completely and reinstall it. Still doesn't work.....
Best Regards,
> This is the second time I encounter this problem, and I have to
> reinstall VS.NET last time, and seems like I still have to do the same
[quoted text clipped - 32 lines]
> Best Regards to all VS developer accessing Excel File,
> Homa Wong
Homa - 27 Aug 2003 02:48 GMT
Follow up:
I confirmed this bug is reproducible. Here is the details:
The problem lies on creating new connection. This can be accessed by
the connectionString Property in the IDE, or the Server Explorer tools
bar -> Add connection.
When you put in the information for an Excel File (Jet 4.0, FilePath,
Extended Property = "Excel 8.0") and click ok, an empty DataLink
Dialog will appear again. There are two scenarios:
1. If you click cancel in this DataLink Dialog, you will receive this
popup twice:
Unable to connect to database.
The connection failed. Check your username and password, and try again
(of course, the username and password is correct).
2. If you enter the information again and click ok:
..........you are doomed.
You can see the connection in the Server Explorer. You can access it,
see there are Sheet1$, Sheet2$, Sheet3$ (or your Sheet name) and you
can see the column in it. But the connection will named as "ACCESS:
[filepath]" and you cannot create OleDbConnection with it because now
when you pulldown the connection string property you will get a
"Object reference not set to an instance of an object"
If you try to create a OleDbDataAdapter using the wizard, you will get
a more detailed error message:
An unexpected error has occurred.
Error Message: Object reference not set to an instance of an object.
Call Stack: at Microsoft.VSDesigner.Data.VS.VsConnectionManager.CheckConnectoin(Int32
index, ProviderNameInfo nameInfo)
at Microsoft.VSDesigner.Data.VS.VsConnectionManager.GetConnectionNameList(ArrayList
nameList, ProviderNameInfo nameInfo)
at Microsoft.VSDesigner.Data.VS.ConnectionPage.InitInput()
at Microsoft.VSDesigner.Data.VS.ConnectionPage.OnEnterPage(EventArgs
e)
at Microsoft.VSWizards, WizardPage.RaiseEnterPage()
at Microsoft.VSWizards.WizardForm.NextPage()
at Microsoft.VSWizards.WizardForm.Next_Click(Object sender, EventArgs
e)
(I know the lines beside the first two is meaningless, but I put them
in anyway).
As I mentioned in prior post, this bug is not fixable by repair,
uninstall->reinstall. What I did is reinstall the whole Windows. (I'm
using Windows XP)
Does anyone knows about this bug and have a fix/solution about it?
Homa Wong
Jason Zha - 27 Jan 2005 03:39 GMT
You do not need to reinstall you OS.
The reason is there is an invalid item in your DATA CONNECTIONS. To resolved the issue, you can open then server view and delete the invalid one. Then it works.