Exporting to an Executable File

Traditionally, sharing data between users requires exporting data into a common format, such as a text file or a spreadsheet file, and then importing the file on the receiving side. 

WinSQL provides the ability to share data SQL-generated query results with other users in the form of an executable (EXE) file. With a few keystrokes, you can:

·Save the results of any SELECT statement to an EXE file. This executable can either be:

§Static - always displays the same data

§Dynamic - refreshes data from the server each time it is run

·Share the EXE file with other users, with no specific application requirements other than use of the Windows XP, Windows 2000, Windows 2003, Windows 2008, Windows Vista, or Windows 7 operating systems.

·Create an EXE file containing an unlimited number of rows of data that can easily be searched, sorted, and printed. This data can be copied and pasted into other applications, such as Microsoft Excel, for further manipulation and analysis.

·When this EXE file is run, it will allow users to:

§Print a report based on the data

§Search data

§Copy data and paste into applications like Microsoft Excel

§Double-click the column header to sort the data

§Show or hide desired columns

No other file is required to run the executable if it is static. An ODBC driver is required if the executable is created as dynamic.

Prerequisites

No prerequisites exist for static executable files. WinSQL creates a self-contained file that runs on any machine without installation and does not need any other file in order to run. When you create a dynamic executable, the generated file must connect to the database at run time. This means you must have the ODBC driver installed on the target machine. Due to installation complexities and licensing issues, the generated file does not include the ODBC driver.

Additionally, you must specify a valid connection string that is used to establish connection to the database. There are two types of connection strings:

·Contains a data source name (DSN)

·Contains the ODBC driver name

If you expect the same DSN on the target machine, you can have WinSQL copy the parameters of your existing connection to the generated executable.

If the same DSN does not exist on the target machine, you must specify a connection string containing the driver name. A connection string contains parameters as name-value pairs. For more information, see the “Connection Strings” topic in this document.

Perform the following steps to create an EXE file:

1          Select a query, and display the query results in grid form. For more information, see Displaying Query Results.

2          Right-click within the results grid in the window that displays (depicted), and then click Save to executable:

 


 

The Save to Executable window displays:

 

 

3          Select the desired executable type, and then click Next.

If Dynamic Executable is selected, a window similar to the following displays:

A static executable, on the other hand, will simply save the grid contents and allow you to view it at a later time. It will not fetch fresh contents from the database.

4          In the Specify a connection string field, type the connection string you wish to use to connect to the database.

If you expect the same DSN to be available on the target machine, you can select the Use existing connection attributes check box.

5          Click Next. A window similar to the following displays:

6          Complete the fields on this window, using the information in the following table as a guideline:

Option

Description

Executable Title

Type a name to use as the title for this EXE file. This name displays when the EXE file is generated. 

Remarks

Use this field (optional) to type comments about the EXE file. These remarks display on the “Messages” tab in the generated EXE file.

Include SQL Query

Select this option to include the SQL query in the EXE file.

Save all grids

Select this option to save all grids in the query in the resulting EXE file.

Output file name

Specify the name of the EXE file name. If you do not wish to save the EXE file in the default location, click Browse to navigate to another location.

7          Once all options have been selected or entered, click OK to create the EXE file.

The file is created in the specified location and can now be shared with other users.

The following screenshot depicts a generated EXE file:

Notice that the screen shot above looks similar to WinSQL's result grid. In reality, it belongs to the generated executable. Similar to WinSQL, multiple result sets are displayed in different tabs, allowing the user to select the desired results.

If the generated executable is dynamic, the data is refreshed when the executable is run. For any reason, if this executable is not able to connect to the database to fetch fresh data, it will act as if it were a static file, displaying stale records.