Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connect to DBC database
Message
De
31/10/2023 07:58:52
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Connect to DBC database
Divers
Thread ID:
01687153
Message ID:
01687153
Vues:
73
HI,

I need to create a connection to Visual Foxpro DBC database for query specific table documentos and insert the result into Cursor for creating a new table on SQL server to insert the result of my cursor.
This is my code:
LOCAL loConnection
loConnection = CREATEOBJECT("ADODB.Connection")


SET DATE BRITISH

lcDBCPath = Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=D:\1.Bnext_Espanha\Orozco\EMP01\gestion.dbc;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;



* Attempt to establish a connection
TRY
    loConnection.Open(lcDBCPath)
    ? "Connected to the database successfully."
    * Now you can execute SQL commands and queries.

    * For example, retrieve data from a table
    lcSQL = "SELECT * FROM documentos"
    loCursor = loConnection.Execute(lcSQL)
    ? loCursor.GetString()

    * Don't forget to close the connection when done
    loConnection.Close()
CATCH TO loError
    ? "Failed to connect to the database. Error: " + loError.Message
ENDTRY
But i have this error:
Date/datetime contains illegal characters.

Someone could help me , please.
Many thanks
Luis
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform