DBWExecSQL

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > Database >

DBWExecSQL

Description

Executes an SQL command passed by a string.

Syntax

Function DBWExecSQL(cmdSql)

Parameters

cmdSql

An sql command to be executed.

Remarks

After calling this function check the boolean value of the okDBW variable:

TRUE

if the command has been executed

FALSE

otherwise

This function executes the specified sql command.

Please note in the example the use of shell commands wait and requery.

After an insert action, the Microsoft Jet database management module needs a little time for flushing updates into database. In facts doing a requery immediately after the update don't let you see any changes. The wait command let Jet do flush in a right way.

Example

Sub main()
 Set swApp = CreateObject ("SldWorks.Application")
 cmdLine = "INSERT INTO DOCUMENT "
 cmdLine = cmdLine & "(T,ID,DESCRIPTION,CREATED_BY,CREATION_DATE,COST) "
 cmdLine = cmdLine & "VALUES "
 cmdLine = cmdLine & "('0','TestProject','Description of test project','Ciro','1999/04/26',1500)"
 DBWExecSQL( cmdLine )
 if (okDBW = False) then exit sub
 call DBWShell( "Wait" )
 if (okDBW = False) then exit sub
 call DBWShell( "Requery" )
 if (okDBW = False) then exit sub
End Sub