Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFPOLEDB doesn't work
Message
From
15/03/2003 12:09:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/03/2003 10:55:43
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00766180
Message ID:
00766196
Views:
20
>Hi,
>Using the following code, I try to connect to a Visual FOXPRO database from Visual C++.
>The database is named "GRM2003.DBC" and is located in the directory "C:\GRM2003".
>There is no error after the compilation but while running, When the program tries to open
>the connection the following error occures : "invalid path or file name".
>I don't understand this error because I have checked names and pathes.
>
>#include "stdafx.h"
>
>#using
>#using
>#using
>#include
>
>using namespace System;
>using namespace System::Data;
>using namespace System::Data::OleDb;
>
>void main()
>{
> OleDbConnection *myConnection = new OleDbConnection();
> myConnection->ConnectionString="Provider=VFPOLEDB;Data Source=C:\GRM2003\GRM2003.DBC";
>
> try
> {
> myConnection->Open();
> Console::WriteLine(S"Connected to database successfully!");
> }
> catch (OleDbException * Xcp)
> {
> Console::Write(S"Error occured: ");
> Console::WriteLine(Xcp->Message);
> }
> myConnection->Close();
> Console::WriteLine(S"Disconnected");
>}

In C you need 2 backslashes for path separators.
"Provider=VFPOLEDB;Data Source=C:\\GRM2003\\GRM2003.DBC"
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform