DS (Data Source)

Description

Data source (DS) is usually a sub-object to the data object object, but can be instantiated independently.  Also, in the TextConverter it's built in to the component and accessible by the name "this.DSOut".

The DS object provides database connection information and allows running of SQL commands against a connected database resource (table, view or stored procedure). In most cases, the data source is set up through the Input data source editor.

Note: These methods cannot be used to modify or use an external data source (if you need access to external data sources use the "DB" object instead)

Hint: a DS object could be also used for storing a path to a filesystem or network folder, even if there is no real database. It will let you conveniently adapt your project when its location changes.

Hint: Type the datasource instance name then type in dot character (".") - you will reveal the list of available object's members (see the illustration on the right).

Inner Members

Properties and Methods by Category

DataBase

clsid

database

schema

valid

user

password

dsn

SetDS()

GetAsString()

SetParam()

Tables

alias

table

extension

Create()

Drop()

GetFROM()

SetFROM()

GetRelation()

GetTableNames()

ReplaceTable()

GetCustomSelect()

SetCustomSelect()

TableExists()

Fields 

GetFieldNames()

LoadFields()

SQL

CallFunction()

CallProcedure()

Execute()

CSV

csv_col_separator

csv_include_column_names

csv_positional

csv_text_qualifier

Utility

Format()

Examples

You can set output table using two methods: setting the table name (assuming you are connected to a database) - (a) and setting the entire data source - (b):

If you are writing script outside TextConverter the API looks like this: 

Set DS = TextConverter.GetOutputDS()

DS.table = "tablename" )         '- (a)

DS.SetDS( "c:\data\output.dbf" ) '- (b)

If you are writing script inside TextConverter it looks like this:

This.DSOut.table = "tablename" )         ‘- (a)

This.DSOut.SetDS( "c:\data\output.dbf" ) ‘- (b)

An Excel file is also considered as a database, so you can set the worksheet as:

Set DS = TextConverter.GetOutputDS()

DS.table = "worksheetname" )             ‘- (a)

DS.SetDS( "...\file.mdb:worksheetname" ) ‘- (b)

See also

TextConverter Object