473,385 Members | 2,029 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.

Northwind connection issue

I am learning to program C++ .net and am having difficulty with one of the
exercises and wondered if someone could help?
I am including the code for a console app I wrote according to the exercise
that is supposed to create a connection to the
Northwind.mdb database. I modified the code for the ConnectionString to
include the path to where I found Northwind.mdb
to be located on my machine. When I run the program, I get the following
error:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll Additional information:
The 'Microsoft.Jet.OLEDB.4.0: Data Source=C:\Program Files\Microsoft
Office\Office\Samples\northwind.mdb' provider is not
registered on the local machine.

Can anyone help me?

// This is the main project file for VC++ application project // generated
using an Application Wizard. #include "stdafx.h" #using using namespace
System; //Generic ADO.NET definitions using namespace System::Data;
//specific Oledb provider definitions using namespace System::Data::OleDb;
int _tmain() { //create a connection OleDbConnection* cnNwind = new
OleDbConnection(); //Set the connection string cnNwind->ConnectionString = S"
Provider=Microsoft.Jet.OLEDB.4.0: " S"Data Source=C:\\Program
Files\\Microsoft Office\\Office\\Samples\\northwind.mdb"; try { //Open the
database cnNwind->Open(); Console::WriteLine(S"Connected to database
successfully!"); } catch(OleDbException* pe) { Console::Write(S"Error
occurred: "); Console::WriteLine(pe->Message); } //Close the connection if
(cnNwind->State != ConnectionState::Closed) { cnNwind->Close(); }
Console::WriteLine(S"The database connection is now closed"); return 0; }
Jan 18 '06 #1
2 4061
Hi,

You have a bug in your connection string:
S"Provider=Microsoft.Jet.OLEDB.4.0:" ...blabla
There should be semicolon instead of colon
S"Provider=Microsoft.Jet.OLEDB.4.0;" ...blabla

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"JohnnyBoy" wrote:
I am learning to program C++ .net and am having difficulty with one of the
exercises and wondered if someone could help?
I am including the code for a console app I wrote according to the exercise
that is supposed to create a connection to the
Northwind.mdb database. I modified the code for the ConnectionString to
include the path to where I found Northwind.mdb
to be located on my machine. When I run the program, I get the following
error:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll Additional information:
The 'Microsoft.Jet.OLEDB.4.0: Data Source=C:\Program Files\Microsoft
Office\Office\Samples\northwind.mdb' provider is not
registered on the local machine.

Can anyone help me?

// This is the main project file for VC++ application project // generated
using an Application Wizard. #include "stdafx.h" #using using namespace
System; //Generic ADO.NET definitions using namespace System::Data;
//specific Oledb provider definitions using namespace System::Data::OleDb;
int _tmain() { //create a connection OleDbConnection* cnNwind = new
OleDbConnection(); //Set the connection string cnNwind->ConnectionString = S"
Provider=Microsoft.Jet.OLEDB.4.0: " S"Data Source=C:\\Program
Files\\Microsoft Office\\Office\\Samples\\northwind.mdb"; try { //Open the
database cnNwind->Open(); Console::WriteLine(S"Connected to database
successfully!"); } catch(OleDbException* pe) { Console::Write(S"Error
occurred: "); Console::WriteLine(pe->Message); } //Close the connection if
(cnNwind->State != ConnectionState::Closed) { cnNwind->Close(); }
Console::WriteLine(S"The database connection is now closed"); return 0; }

Jan 18 '06 #2
That did it!!!!
Thanks so much for replying!

"Milosz Skalecki" wrote:
Hi,

You have a bug in your connection string:
S"Provider=Microsoft.Jet.OLEDB.4.0:" ...blabla
There should be semicolon instead of colon
S"Provider=Microsoft.Jet.OLEDB.4.0;" ...blabla

Hope this helps
--
Milosz Skalecki
MCP, MCAD
"JohnnyBoy" wrote:
I am learning to program C++ .net and am having difficulty with one of the
exercises and wondered if someone could help?
I am including the code for a console app I wrote according to the exercise
that is supposed to create a connection to the
Northwind.mdb database. I modified the code for the ConnectionString to
include the path to where I found Northwind.mdb
to be located on my machine. When I run the program, I get the following
error:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll Additional information:
The 'Microsoft.Jet.OLEDB.4.0: Data Source=C:\Program Files\Microsoft
Office\Office\Samples\northwind.mdb' provider is not
registered on the local machine.

Can anyone help me?

// This is the main project file for VC++ application project // generated
using an Application Wizard. #include "stdafx.h" #using using namespace
System; //Generic ADO.NET definitions using namespace System::Data;
//specific Oledb provider definitions using namespace System::Data::OleDb;
int _tmain() { //create a connection OleDbConnection* cnNwind = new
OleDbConnection(); //Set the connection string cnNwind->ConnectionString = S"
Provider=Microsoft.Jet.OLEDB.4.0: " S"Data Source=C:\\Program
Files\\Microsoft Office\\Office\\Samples\\northwind.mdb"; try { //Open the
database cnNwind->Open(); Console::WriteLine(S"Connected to database
successfully!"); } catch(OleDbException* pe) { Console::Write(S"Error
occurred: "); Console::WriteLine(pe->Message); } //Close the connection if
(cnNwind->State != ConnectionState::Closed) { cnNwind->Close(); }
Console::WriteLine(S"The database connection is now closed"); return 0; }

Jan 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: RibGnaw | last post by:
Long, long ago when Access 97 first hit the streets a sample database called Northwind was shipped with it. At that time a number of articles had been posted on the correct procedure to remove all...
8
by: SteveInBeloit | last post by:
Hello, I am trying to learn how to manipulate a table via a Windows Form in vb ..NET. I am able to create the form1, and in the load event, I can put in the necessary ADO connection statements to...
2
by: dennist685 | last post by:
Can't open Northwind I remembered doing walkthrough using Northwind. However it wasn't an http project but a file project using the development server. Northwind allowed me to add, edit and...
1
by: | last post by:
I am try this example on vb express 2005: http://msdn2.microsoft.com/en-US/library/system.windows.forms.datagridviewcomboboxcolumn.aspx but it keeps giving me an error about the data source to...
7
by: galico | last post by:
Hi All, We are having a very strange problem with the above. We have designed an application in ASP.NET 2.0 that uses the enterprise library data application blocks amongst others. We seem to be...
5
by: Harlan Messinger | last post by:
I installed the Northwind database in my SQL Server developer version, added to the server logins, and in OSQL ran use Northwind GO grant all to GO These executed without error. But my...
1
by: podx | last post by:
I am trying to connect to SQL 7.0 northwind database via visual studio 2005. But I can't open the connection. I get an error saying remote access is not allowed. But the remote access is ok. I can...
3
by: asafok | last post by:
hi , for some reason every time i try connecting to my northwind sql server from VS2005 i get an Error massage. first it was the remote connection that didn't allow me to connect and after that i...
2
by: JP | last post by:
In the table Employees of NorthWind database there is a column Photo (data type: image). I want to convert the first row image into a jpg file, but I can't open the file because is not a valid...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.