2
Answers

how to connect web server database from vfp form

RAJESH GUPTA

RAJESH GUPTA

Dec 24
362
1

Sir namaskar!

i have created a database on my web space with one table

i want to connect my vfp form to thsi database, so that data can be saved on server and multiple user can access that form

please tell me how to connect my web server database with odbc

THANKS

RAJESH

Answers (2)
1
RAJESH GUPTA

RAJESH GUPTA

1.1k 607 367 Dec 26

Thanks for reply

i do as instructed but unable to connet

when i press test buttion windows disapper

 i using my sql data baee on web server

which ODBC shold i install on my loca compuer

is there any possibility that i can connect web server data bssewith creating  DSN in loca computer

 

THANLS

0
Jayraj Chhaya

Jayraj Chhaya

310 6k 94.1k Dec 24

Hi RAJESH GUPTA,

To connect your Visual FoxPro (VFP) form to a web server database using ODBC, follow these steps:

  1. Install ODBC Driver: Ensure you have the appropriate ODBC driver installed for your database type (e.g., MySQL, SQL Server).

  2. Create ODBC Data Source:

    • Open the ODBC Data Source Administrator on your machine.
    • Click on the "System DSN" tab and then "Add".
    • Select your database driver and configure the connection settings, including the server address, database name, user credentials, and any other required parameters.
  3. Connect from VFP: Use the following SQL command in your VFP form to establish the connection:

  4. LOCAL lnConnHandle
    lnConnHandle = SQLCONNECT("YourDSNName", "username", "password")
    IF lnConnHandle > 0
        * Connection successful
        =SQLDISCONNECT(lnConnHandle)
    ELSE
        * Handle connection error
        MESSAGEBOX("Connection failed.")
    ENDIF
    
  5. Perform Database Operations: Once connected, you can execute SQL commands to insert, update, or retrieve data from the web server database.

    By following these steps, you can successfully connect your VFP form to a web server database, allowing multiple users to access and manipulate data efficiently.

Next Recommended Forum