Importing Visual FoxPro Databases and Tables

From Lianjapedia
Jump to: navigation, search

See Also

Getting Started, HOWTO integrate Lianja and VFP with concurrent data access, Imported Visual FoxPro Files, Importing Visual FoxPro Files

Overview

This article explains how to import Visual FoxPro databases and tables for reuse in your Lianja Apps. Note: the import functionality is available on Windows only. Once imported, the files can also be used in Lianja on Mac and Linux.

Bm-noteicon.png

Lianja runs with set deleted on by default. This causes records marked for deletion to be hidden.
When importing Visual FoxPro tables, records marked for deletion are ignored if set deleted is on.
To import records marked for deletion, set deleted off in the Lianja/VFP command window before starting the import.

Importing Databases

Visual FoxPro databases (.dbc files) can be quickly and easily imported into the Lianja format for use in your Apps. To import a Visual FoxPro database, select the Data Workspace and make sure no database is open. You then have two ways to import your database: drag and drop import or the Import VFP database command.

Drag and drop import

Drag 'n' drop VFP database



To use drag and drop import:

  • Open the .dbc file location in Windows Explorer
  • Click on the .dbc file and drag it into the Databases explorer in the Sidebar



Open database



To open your imported database. double-click its name in the Databases explorer or select Open in the right-click context menu.


If you double-click the database name, the Tables explorer will be automatically selected. You can switch between the explorers using the tabs at any time.


Close database



Use the Close option in the right-click context menu or under Additional commands to close the database.


Import VFP Database Command

Import VFP database



To use the Import VFP database command:

  • Using the right-click context menu or the Additional commands, click Import VFP database....
  • Select your .dbc file from the popup Select a Visual FoxPro Database dialog.


Open tables



To open your imported database, double-click its name in the Database explorer.


In the Tables explorer, double-click a table's name to open it in the Data Editor.


Each open table will appear in its own tab.



Command Window



From the Lianja/VFP command window in the Console Workspace you can access your imported data using SQL statements or USE and other NoSQL commands.


Note that Lianja has automatically built the indexes for the imported tables.


Note: the maximum field name length in Lianja is 32 characters.


Import ODBC Database

Import ODBC database



If you have the Visual FoxPro ODBC Driver, you can also import databases this way, although it is more commonly used to provide developers with a local copy of SQL databases such as Microsoft SQL Server or MySQL.


Firstly, create a database and make sure it is open before starting the import


Import ODBC database



Switch back to the Databases explorer, then select Import ODBC database... from Additional commands or the right-click context menu.


Import ODBC database



Enter the name of your ODBC DSN or connection string in the dialog, specifying the username and password if required.


To only import specific tables, click Tables and make your selection.


To start the import, click Import.


Import ODBC database



The Console Workspace will be selected to show the progress of the import in the Output Window. Switch back to the Data Workspace and select the Tables explorer to see your imported data.


Double-click a table's name to open it in the Data Editor.


Create Virtual Tables from ODBC

Create Virtual Tables from ODBC



As well as, or instead of, importing the tables from your ODBC data source, you can have Virtual Tables automatically created for them.


Again, create a new database and make sure it is open.


Switch back to the Databases explorer, then select Create Virtual Tables from ODBC... from Additional commands or the right-click context menu.


Create Virtual Tables from ODBC



Enter the name of your ODBC DSN or connection string in the dialog, specifying the username and password if required.


To only create Virtual Tables for specific tables, click Tables and make your selection.


To start the Virtual Table creation, click Import.


The Console Workspace will be selected to show the progress of the import in the Output Window. When you reselect the Data Workspace you will see your imported data.

Importing Free Tables

Visual FoxPro free tables can also be imported. Select the Data Workspace and make sure you have a database open.

Again, there are two ways to do this: drag and drop or the Add command.

Drag and drop import

Drag and drop free table



To use drag and drop import:

  • Open the .dbf file location in Windows Explorer.
  • Click on the .dbf file and drag it into the Tables explorer in the Sidebar.


Add command

Using Add command to import a VFP free table



To use the Add command:

  • Click Add... in the Additional commands or in the right-click context menu.
  • Choose the table to import from the popup Select a table dialog.