TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raymond Flach
NA
3
0
Connecting to Northwind
Jan 16 2006 9:50 PM
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; }
Reply
Answers (
1
)
connecting to a MySQL server
Using SQLDMO to list available SQL Server 2000 DBs