SQL::DeleteStatementExecute Method
Syntax
Arguments
- Result_Flag
TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).
- SQL::DeleteStatement
A SQL::DeleteStatement object.
- SQLConnection
Optional. A SQL::Connection object and with a defined .ConnectionString property.
- Arguments
Optional. A connection string.
Description
Execute the current statement using the current or passed connection. Optionally providing argument values as an object or as XML.
The .Execute() method retrieves data and populates a SQL::ResultSet object. It connects to the back-end database using the information in the SQL::Connection::ConnectionString property or in the ConnectString string, then executes the SQL statement in the SQL::DeleteStatement.SQLStatement property.
Example
Dimension the variables. This script will need SQL::Connection and SQL::DeleteStatement objects to delete the data.
dim conn as SQL::Connection dim del as SQL::DeleteStatement dim connString as C dim sql_delete as C
Assign values to the character variables.
connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"Note that the DELETE command uses the SubString()portability function as part of the WHERE clause.
sql_delete = "DELETE FROM Customer_copy WHERE substring(lastname,1,1) = 'A'"
Establish the connection.
IF .not. conn.open(connString) THEN
end
END IFCheck the SQL DELETE statement.
IF .not. del.parse(sql_delete) THEN
ui_msg_box("Error", del.callresult.text)
end
END IFExecute the SQL DELETE statement.
IF .not. del.execute(conn)
ui_msg_box("Error", del.callresult.text)
end
END IFSee Also