Exporting a Table to the Back-End


This example will show how to export the Alpha Anywhere AlphaSports customer table to the Access AlphaSports database.

First, dimension two variables.

dim conn as sql::connection
dim resultmsg as C = ""

Open the connection to the database. If an error occurs, display a message and end the script.

if .not. conn.open("{A5API=Access,FileName='C:\Program Files\A5V8\MDBFiles\Alphasports.mdb',UserName='Admin'}") then
    ui_msg_box("Error", "Could not establish connection" + crlf()+ conn.CallResult.text)
end if

Create the target table and copy the data with SQL_TableExport().

sql_tableexport(conn, .t., "C:\Program Files\A5V8\Samples\AlphaSports\customer.dbf", "", "customerB", resultmsg)

Find out if there was an error.

ui_msg_box("", resultmsg)

Close the connection.



Desktop Applications Only

See Also