By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

Access databases can not be used in VS 2005

P: n/a
Hi all,

I am having the following problems in getting Microsoft Visual Studio
2005 Professional to link to an Access .mdb database. Please help me to sort
this out.
Problem 1:
=======
The Microsoft page "How to: Connect to Data in an Access Database
"http://msdn2.microsoft.com/en-us/library/cf131f6b.aspx states the
following on how to connect to a Access database:
1. On the Data menu, click Add New Data Source.
2. Select Database on the Choose a Data Source Type page.
3. 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.
4. The default provider is .NET Framework Provider for OLE DB. For more
information, see Choose/Change Data Source Dialog Box.
5. In the Database file name box, enter the path to the .mdb file, or
click the Browse button to locate the database file.
6. Enter login information if required by your database. For more
information, see Add/Modify Connection (Microsoft Access).
7. Click OK, and then click Next.
In step 5 above it talks of a browse button. I dont't get that but rather am
given a dialog box titled Add Connection and the only option is
ConnectionString. I have tried all sorts of options for a connect string but
allways get the error message "Format of the initialization string does not
conform to
specification starting at index 0"

Problem 2:
=======
From the same page it states: "Drag an .mdf or .mdb file from Windows
Explorer into Solution Explorer to automatically configure your connection
and start the Data Source Configuration Wizard ready for you to select the
objects to use in your application."
When I drag and drop drop an Access database eg. Northwind.mdb into the
Solution Explorer window I get the following error: "An eror occurred while
processing the local data file: Object reference not set to an instance of an
object"

Questions:
=======
1. In problem 1 why don't I get the correct dialog with browse
functionality? I have Microsoft Visual Studio 2005 Professional installed on
my Laptop and my main PC and they both do the same thing. I have all patches
and updates installed.
2. How do I resolve problem 2? I have searched for a solution and and have
found none. I have uninstalled .Net Framework 2 and reinstalled it with no
difference. I think the two problems are related.

Note: I have also had VS.NET 2002 in parallel on the same box, which had
been uninstalled in the meantime. So I reinstalled VS 2005 too, but the
problem remains. However ODBC for Access databases works, but this is not
wanted.

Thanks in advance, Fritz
--
Fritz Theiss
Mar 18 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On Sun, 18 Mar 2007 10:25:05 -0700, Fritz <Fr***@discussions.microsoft.comwrote:

Problem 1:
=======
The Microsoft page "How to: Connect to Data in an Access Database
"http://msdn2.microsoft.com/en-us/library/cf131f6b.aspx states the
following on how to connect to a Access database:


1. On the Data menu, click Add New Data Source.
2. Select Database on the Choose a Data Source Type page.
3. 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.
4. The default provider is .NET Framework Provider for OLE DB. For more
information, see Choose/Change Data Source Dialog Box.
5. In the Database file name box, enter the path to the .mdb file, or
click the Browse button to locate the database file.
6. Enter login information if required by your database. For more
information, see Add/Modify Connection (Microsoft Access).
7. Click OK, and then click Next.


In step 5 above it talks of a browse button. I dont't get that but rather am
given a dialog box titled Add Connection and the only option is
ConnectionString. I have tried all sorts of options for a connect string but
allways get the error message "Format of the initialization string does not
conform to
specification starting at index 0"

In step three when you click on New Connection, change the Data Source to Microsoft Access Database
File and then click on the Browse command button to select the file name. That should take you to
step seven.

Problem 2:
=======
From the same page it states: "Drag an .mdf or .mdb file from Windows
Explorer into Solution Explorer to automatically configure your connection
and start the Data Source Configuration Wizard ready for you to select the
objects to use in your application."


When I drag and drop drop an Access database eg. Northwind.mdb into the
Solution Explorer window I get the following error: "An eror occurred while
processing the local data file: Object reference not set to an instance of an
object"

I can't reproduce this issue.

Sounds like you might have a bad install.
Paul
~~~~
Microsoft MVP (Visual Basic)
Mar 19 '07 #2

P: n/a
Thanks so far.

See inline, commented with Fritz.

--
Fritz Theiss
"Paul Clement" wrote:
On Sun, 18 Mar 2007 10:25:05 -0700, Fritz <Fr***@discussions.microsoft.comwrote:

¤ Problem 1:
¤ =======
¤ The Microsoft page "How to: Connect to Data in an Access Database
¤ "http://msdn2.microsoft.com/en-us/library/cf131f6b.aspx states the
¤ following on how to connect to a Access database:
¤
¤
¤ 1. On the Data menu, click Add New Data Source.
¤ 2. Select Database on the Choose a Data Source Type page.
¤ 3. 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.
¤ 4. The default provider is .NET Framework Provider for OLE DB. For more
¤ information, see Choose/Change Data Source Dialog Box.
¤ 5. In the Database file name box, enter the path to the .mdb file, or
¤ click the Browse button to locate the database file.
¤ 6. Enter login information if required by your database. For more
¤ information, see Add/Modify Connection (Microsoft Access).
¤ 7. Click OK, and then click Next.
¤
¤
¤ In step 5 above it talks of a browse button. I dont't get that but rather am
¤ given a dialog box titled Add Connection and the only option is
¤ ConnectionString. I have tried all sorts of options for a connect string but
¤ allways get the error message "Format of the initialization string does not
¤ conform to
¤ specification starting at index 0"

In step three when you click on New Connection, change the Data Source to Microsoft Access Database
File and then click on the Browse command button to select the file name. That should take you to
step seven.
Fritz: No, it does not. There is no browse button available.
>
¤ Problem 2:
¤ =======
¤ From the same page it states: "Drag an .mdf or .mdb file from Windows
¤ Explorer into Solution Explorer to automatically configure your connection
¤ and start the Data Source Configuration Wizard ready for you to select the
¤ objects to use in your application."
¤
¤
¤ When I drag and drop drop an Access database eg. Northwind.mdb into the
¤ Solution Explorer window I get the following error: "An eror occurred while
¤ processing the local data file: Object reference not set to an instance of an
¤ object"

I can't reproduce this issue.
Fritz: I believe so as I can´t reproduce either on a different machine,
having VS.NET 2002 not installed previously.
>
Sounds like you might have a bad install.
Fritz: I know. The question is: How to get rid of this? As written:
Reinstallation of VS 2005 did not help. From a different thread I saw that
this guy completely(!) reinstalled his machine in order to have this problem
fixed. This option is not available to me.
>

Paul
~~~~
Microsoft MVP (Visual Basic)
Mar 19 '07 #3

P: n/a
Any (further) ideas are appreciated.

Thanks, Fritz
--
Fritz Theiss
"Fritz Theiss" wrote:
Thanks so far.

See inline, commented with Fritz.

--
Fritz Theiss
"Paul Clement" wrote:
On Sun, 18 Mar 2007 10:25:05 -0700, Fritz <Fr***@discussions.microsoft.comwrote:

¤ Problem 1:
¤ =======
¤ The Microsoft page "How to: Connect to Data in an Access Database
¤ "http://msdn2.microsoft.com/en-us/library/cf131f6b.aspx states the
¤ following on how to connect to a Access database:
¤
¤
¤ 1. On the Data menu, click Add New Data Source.
¤ 2. Select Database on the Choose a Data Source Type page.
¤ 3. 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.
¤ 4. The default provider is .NET Framework Provider for OLE DB. For more
¤ information, see Choose/Change Data Source Dialog Box.
¤ 5. In the Database file name box, enter the path to the .mdb file, or
¤ click the Browse button to locate the database file.
¤ 6. Enter login information if required by your database. For more
¤ information, see Add/Modify Connection (Microsoft Access).
¤ 7. Click OK, and then click Next.
¤
¤
¤ In step 5 above it talks of a browse button. I dont't get that but rather am
¤ given a dialog box titled Add Connection and the only option is
¤ ConnectionString. I have tried all sorts of options for a connect string but
¤ allways get the error message "Format of the initialization string does not
¤ conform to
¤ specification starting at index 0"

In step three when you click on New Connection, change the Data Source to Microsoft Access Database
File and then click on the Browse command button to select the file name. That should take you to
step seven.

Fritz: No, it does not. There is no browse button available.

¤ Problem 2:
¤ =======
¤ From the same page it states: "Drag an .mdf or .mdb file from Windows
¤ Explorer into Solution Explorer to automatically configure your connection
¤ and start the Data Source Configuration Wizard ready for you to select the
¤ objects to use in your application."
¤
¤
¤ When I drag and drop drop an Access database eg. Northwind.mdb into the
¤ Solution Explorer window I get the following error: "An eror occurred while
¤ processing the local data file: Object reference not set to an instance of an
¤ object"

I can't reproduce this issue.

Fritz: I believe so as I can´t reproduce either on a different machine,
having VS.NET 2002 not installed previously.

Sounds like you might have a bad install.

Fritz: I know. The question is: How to get rid of this? As written:
Reinstallation of VS 2005 did not help. From a different thread I saw that
this guy completely(!) reinstalled his machine in order to have this problem
fixed. This option is not available to me.


Paul
~~~~
Microsoft MVP (Visual Basic)
Mar 20 '07 #4

P: n/a
On Tue, 20 Mar 2007 01:28:08 -0700, Fritz Theiss <Fr*********@discussions.microsoft.comwrote:

Any (further) ideas are appreciated.

I would uninstall any versions of Visual Studio.NET you have installed. Also, uninstall all versions
of the .NET Framework and make sure to delete any files or folders that are left over before
reinstalling.
Paul
~~~~
Microsoft MVP (Visual Basic)
Mar 20 '07 #5

P: n/a
As written previously - I have uninstalled both versions of VS and only
re-installed VS 2005. Ok, I did not uninstall .NET Framework. But this I
declined on purpose.

Due to another issue in the past, I have contacted MS Support: Their
recommendation in case of un-installing .NET Framework is: Re-install the
complete box due to appearing inconsistencies. And this is - as said - not on
my radar...

--
Fritz Theiss
"Paul Clement" wrote:
On Tue, 20 Mar 2007 01:28:08 -0700, Fritz Theiss <Fr*********@discussions.microsoft.comwrote:

¤ Any (further) ideas are appreciated.

I would uninstall any versions of Visual Studio.NET you have installed. Also, uninstall all versions
of the .NET Framework and make sure to delete any files or folders that are left over before
reinstalling.
Paul
~~~~
Microsoft MVP (Visual Basic)
Mar 20 '07 #6

P: n/a
I've also just recenlty run into this problem and would like to know how
to fix it.

I've installed it on a laptop & workstation with the only signinficant
difference between the two being that the laptop has Office 2007 on it
(and this is the machine it does NOT work on) and the workstation has
Office XP (and this is the machine it DOES work on).

This problem has signinficant decreased my productivity since I now have
to manually create all the connection objects, data adpater objects, and
(worst of all) configuring the Grid View control controls for the
resulting dataset.

I am also in a position where a complete uninstall of Windows XP is not
an option.

Thank you,

Drew
Jun 10 '07 #7

P: n/a
On 09 Jun 2007, you wrote in microsoft.public.vsnet.general:
I've also just recenlty run into this problem and would like to know
how
to fix it.

I've installed it on a laptop & workstation with the only signinficant
difference between the two being that the laptop has Office 2007 on it
(and this is the machine it does NOT work on) and the workstation has
Office XP (and this is the machine it DOES work on).

This problem has signinficant decreased my productivity since I now
have
to manually create all the connection objects, data adpater objects,
and
(worst of all) configuring the Grid View control controls for the
resulting dataset.

I am also in a position where a complete uninstall of Windows XP is
not
an option.

Thank you,

Drew
I think I might have a solution.
I noticed my Server Explorer had a Data Connection to a local instance
of
a SQL server that I no longer have on my laptop, so I removed it.

On a lark, the next time I opened VS 2005 I thought I'd give the Access
Data Connection another try and this time it worked!

I'm guessing if you still have a problem, check your other Data
Connections listed in the Server Explorer and remove any that you aren't
using. Worth a shot!

--
Drew
Jun 10 '07 #8

P: n/a
Ok, I am having the same problem. I have deleted all my connections and
tried it again, and it did not fix it. I have VS2003 and VS2005 on my
machine and have uninstalled and reinstalled VS2005 to no avail.
In my case, this was working at one time and has stopped! The only
significant change I have made to this machine was to upgrade IE from version
6 to 7.

Anyone have anymore ideas?

--
Terry
"Fritz" wrote:
Hi all,

I am having the following problems in getting Microsoft Visual Studio
2005 Professional to link to an Access .mdb database. Please help me to sort
this out.
Problem 1:
=======
The Microsoft page "How to: Connect to Data in an Access Database
"http://msdn2.microsoft.com/en-us/library/cf131f6b.aspx states the
following on how to connect to a Access database:
1. On the Data menu, click Add New Data Source.
2. Select Database on the Choose a Data Source Type page.
3. 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.
4. The default provider is .NET Framework Provider for OLE DB. For more
information, see Choose/Change Data Source Dialog Box.
5. In the Database file name box, enter the path to the .mdb file, or
click the Browse button to locate the database file.
6. Enter login information if required by your database. For more
information, see Add/Modify Connection (Microsoft Access).
7. Click OK, and then click Next.
In step 5 above it talks of a browse button. I dont't get that but rather am
given a dialog box titled Add Connection and the only option is
ConnectionString. I have tried all sorts of options for a connect string but
allways get the error message "Format of the initialization string does not
conform to
specification starting at index 0"

Problem 2:
=======
From the same page it states: "Drag an .mdf or .mdb file from Windows
Explorer into Solution Explorer to automatically configure your connection
and start the Data Source Configuration Wizard ready for you to select the
objects to use in your application."
When I drag and drop drop an Access database eg. Northwind.mdb into the
Solution Explorer window I get the following error: "An eror occurred while
processing the local data file: Object reference not set to an instance of an
object"

Questions:
=======
1. In problem 1 why don't I get the correct dialog with browse
functionality? I have Microsoft Visual Studio 2005 Professional installed on
my Laptop and my main PC and they both do the same thing. I have all patches
and updates installed.
2. How do I resolve problem 2? I have searched for a solution and and have
found none. I have uninstalled .Net Framework 2 and reinstalled it with no
difference. I think the two problems are related.

Note: I have also had VS.NET 2002 in parallel on the same box, which had
been uninstalled in the meantime. So I reinstalled VS 2005 too, but the
problem remains. However ODBC for Access databases works, but this is not
wanted.

Thanks in advance, Fritz
--
Fritz Theiss
Jun 18 '07 #9

P: n/a
Try this
assume xxx.mdb contains a table called 'table name' which contains ID,
lname, fname.
string constring= "provider= Microsoft.Jet.OLEDB; Data source= c:\xxx.mdb";
OlebConnection connection= new Oledbconnection(constring);
connection.Open();
OleDataadapter da= new Oledataadapter ("Select * from table name",connection);
Dataset ds= new Dataset();
da.fill(ds,"table name");
connection.Close();
foreach(DataRow d in ds.Tables[table name].Rows)
{
MessageBox.Show("Ifound "+ d["lname"].ToString()+" "+d["fname"].ToString());
}
You may also use a dataview to find data

Dataview DV= new DataView(ds.Tables[table name"],"","fname",Dataviewoptions.
none);

int f= DV.Find("frank");

if (f -1)
{
MessageBox. Show( "I found Frank at row"+ f);
or MessageBox.Show (DV[f]["fname"].ToString() +" "+
DV[f]["Lname"].ToString()+ " was found at row "+f );

}


"Drew" wrote:
I've also just recenlty run into this problem and would like to know how
to fix it.

I've installed it on a laptop & workstation with the only signinficant
difference between the two being that the laptop has Office 2007 on it
(and this is the machine it does NOT work on) and the workstation has
Office XP (and this is the machine it DOES work on).

This problem has signinficant decreased my productivity since I now have
to manually create all the connection objects, data adpater objects, and
(worst of all) configuring the Grid View control controls for the
resulting dataset.

I am also in a position where a complete uninstall of Windows XP is not
an option.

Thank you,

Drew
Sep 11 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.