473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access databases can not be used in VS 2005

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
9 1947
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Uwe Range | last post by:
Hi to all! A customer of mine told me some days ago that her IT-people told her ACCESS would not be such a good idea for continuing with our project, because Access will not be continued in the...
9
by: MM | last post by:
And Access 2000 et seq 32 bit? MM
1
by: com | last post by:
Extreme Web Reports 2005 - Soft30.com The wizard scans the specified MS Access database and records information such as report names, parameters and subqueries. ......
17
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a...
2
by: Anns via SQLMonster.com | last post by:
I have about 20 Ms Access Databases to need to be upload onto a SQL Server 2005. Currently the are on a network/server residing on a specific drive. The goal is to keep the user face the same...
3
by: Anns via AccessMonster.com | last post by:
Pros and Cons to the below: Upsizing Wizard - will this carry over tbls, queries, etc together? DTS or IS SQL 2005 - does this only bring over the tables? Which should I use? After the...
18
by: surfrat_ | last post by:
Hi, 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...
26
by: codercode | last post by:
I'm working on a Visual Basic .NET using Access database. However, my client already have a 30MB database with Sybase ASA and Sybase is way too much for that. Is there anyway I can migrate from a...
2
by: JA | last post by:
Is it possible to connect to Sql Server 2005 using an Access 2000 adp? I keep trying, but it doesn't want to accept my id, even though it is right.
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.