Executes a command on a specified database. A connection string is used to specify how to connect to the database. If a standby connection string is specified then the standby path is used if the primary path is offline. Make the command an SQL type command, for example:
"SELECT * FROM MyTable WHERE TimeValue(Time) > #10:00:00#" etc.
Example connection strings:
SQL Server:
"Provider=sqloledb;Data Source=MySQLServerName;Initial Catalog=MyDatabase;User Id=MyUserID;Password=MyPassword;"
Access:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=MyUserID;Password=MyPassword;"
Oracle:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=MyUserID;Password=MyPassword;"
Excel:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\somepath\MyExcel.xls; Extended Properties=Excel 8.0;HDR=Yes;IMEX=1"
where:
HDR=Yes
; indicates
that the first row contains columnnames, not data
IMEX=1
; tells the
driver to always read "intermixed" data columns as text
Text:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\somepath\MyTxtFilesFolder\;Extended Properties=text;HDR=Yes;FMT=Delimited"
where:
"HDR=Yes
;"
indicates that the first row contains column names, not data
DBF:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\somepath\MyDbfFolder;Extended Properties=dBASE IV;User ID=Admin;Password="
DSN:
"DSN=MyDsn;Uid=MyUserID;Pwd=MyPassword;"
UDL:
"File Name=c:\somepath\myDataLink.udl;"
Syntax
CSV_DB_Execute(sCommand,sPrimaryConnection,sStandbyConnection)
#sCommand:
Command to execute
#sPrimaryConnection:
Connection string for primary connection path.
#sStandbyConnection:
Connection string for standby connection path.
Return Value
Handle to the resulting recordset if successful, otherwise -1.