Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPOLEDB doesn't work
Message
De
15/03/2003 12:09:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/03/2003 10:55:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00766180
Message ID:
00766196
Vues:
19
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform