repost of an old question on a problem with Access connection...

G

Guest

When I asked this question before, don't think I was showing up as an MSDN
subscriber, so I hope that is fixed now.

I am a newbe here and am working through some books on using ADO.Net.
These database books were writen for VS2003. I have both VS2003 andVS2005.
In VS2003 all works fine. Right click 'Data Connections', select add new
connection, switch to 'Provider' tab and select
Provider=Microsoft.Jet.OLEDB.4.0, click Next, and browse to the Access mdf
file and all is ok.
In VS2005 this does not work! I right click 'Data Connections', select
add new connection. The Add Connections dialog appears, the Data Source is
preset to '.NET Framwork Data Provider for OLE DB'. I drop down the 'OLE DB
Provider' and select 'Microsoft Jet 4.0 OLE DB Provider'. Click 'Data
Links...', browse to the Access mdf file and hit ok. I test the connection
and it is OK. I hit the Ok button to finish the process and get the
following error message: Object reference not set to an instance of an
object.

Any/all help is greatly appreciated in advance.
 
G

Guest

This getting damn frustrating!
I have read in the documentation that I can drag the .mdb file to solution
explorer and get a connection, but when I try this I get the same error.
The database icon is there but no schema file.
I also read in the documentation that I can do the following:

On the Data menu, click Add New Data Source.

Select Database on the Choose a Data Source Type page.

Select New Connection to create a new data connection.

Note
If the Data source is not Microsoft Access Database File, then select Change
to open the Choose/Change Data Source dialog box, select Microsoft Access
Database File, and then click Continue.


The default provider is .NET Framework Provider for OLE DB. For more
information, see Choose/Change Data Source Dialog Box.

******In the Database file name box, enter the path to the .mdb file, or
click the Browse button to locate the database file.

Problem is that is not where I am taken after chosing Access DataBase File -
I am at a dialog asking for a connection string! And no matter what I put in
there, I get an error message thats says :

Format of the initialization string does not conform to specification
starting at index 0.

This should not be that hard! I can add ODBC data sources and sql data
sources but not an Access database. This works fine in VS2003 but not in
2005 -
HELP!!!!

--
 
L

Linda Liu [MSFT]

Hi Terry,

Based on my understanding, you can add a connection to a Access database
file in VS.NET2003, but couldn't do this in VS2005. If I'm off base, please
feel free to let me know.

I performed a test in VS2005, but didn't reproduece the problem on my side.
The following is the steps of my test.

1. Create an Access database file called Database1.mdb and save it to the
root path of D:\.

2. Open VS2005. In the Server Explorer, right click the 'Data Connections'
node and choose 'Add Connection'.

3. In the 'Add Connection' dialog, if the text in the 'Data source' textbox
isn't 'Microsoft Access Database File(OLE DB)', click the 'Change' button
and 'Change Data Source' dialog appears. In this dialog, select 'Microsoft
Access Database File' in the 'Data source' list(at this time, the below
'Data Provider' combobox only contains '.NET Framework Data Provider for
OLE DB'), and press OK and return to the 'Add Connection' dialog.

4. In the 'Add Connection' dialog, click the 'Browse' button to browse to
the Database1.mdb file and press OK.

5. A new node 'Access.D:\Database1.mdb' appears under the 'Data Connection'
node in the Server Explorer.

The version of VS2005 on my machine is Visual Studio 2005 Team Suite
Version 8.0.50727.42(RTM.050727-4200). What's the version of VS2005 on your
machine?

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi Linda,
This is a strange problem. I originally posted this in June, but there
was a problem with my no-spam alias and the one registered with my MSDN
subscription, so I got no answeres back then. Also, at that time, I found 2
other threads discussing the same problem. In one of those threads, the
problem suddenly went away - very strange. In my case, I uninstalled VS2005
and reinstalled it and the problem was still there. I tried at least 40-50
times to create a data source from an access database and could not do it
using the OLEDB Jet 4 provider. I got around the problem by setting up an
ODBC connection.
Yesterday, I saw someone having a problem with "Object reference not set
to an instance of an object." and was reminded that I had never got an answer
to the original question, so I reposted it now that my no-spam alias problem
was fixed.
After reposting it, I went in and tried it again and guess what - the
problem had gone away! So just like the other thread, somehow it had fixed
itself. Very strange.
So on my machine, it had originally worked, stopped working for at least
2 weeks and sometime after that started working again and I have no idea how
or why. I do know that I am not the only one who has expierenced this same
behavior. You might want to look for these other threads in the archives,
they were the exact same problem I had.
 
L

Linda Liu [MSFT]

Hi Terry,

Thank you for your prompt response.

Microsoft Jet Database Engine is shipped with Windows Operation System. In
the %windir%/System32 folder, there's a dll file named 'msjet40.dll'. From
the property of the file, you could see the versions of the file.

The following KB article discusses how to obtain the latest service pack
for the Microsoft Jet 4.0 Database Engine and how to determine the current
release level of Jet 4.0:

http://support.microsoft.com/kb/239114/

If your problem happens again in the future, you may have a try installing
the lastest service pack for the Microsoft Jet 4.0 Database Engine.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu [MSFT]

Hi Terry,

Thank you for your prompt response.

Microsoft Jet Database Engine is shipped with Windows Operation System. In
the %windir%/System32 folder, there's a dll file named 'msjet40.dll'. From
the property of the file, you could see the versions of the file.

The following KB article discusses how to obtain the latest service pack
for the Microsoft Jet 4.0 Database Engine and how to determine the current
release level of Jet 4.0:

http://support.microsoft.com/kb/239114/

If your problem happens again in the future, you may have a try installing
the lastest service pack for the Microsoft Jet 4.0 Database Engine.

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu [MSFT]

Hi Terry,

Sorry for my delayed reply!

I know you made great effort trying to solve this problem and I appreciate
your detailed feedback on our product.

We will log this issue in our internal database for better product in the
future.

If the problem happens again in the future, please feel free to post a new
thread and we're here to support you at your convenience.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
G

Guest

Thank you Linda for your help with this. Hopefully it will not happen again,
but maybe this will help the next person who happens to run accross it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top