Xbasic

sql_delete Function

Syntax

p Result = sql_delete(SQL::Connection conn, c tableName, c PrimaryKey, c PrimaryKeyValue, l flagExecute [, p options])

p Result = sql_delete(C conn, c tableName, [c PrimaryKey, [c PrimaryKeyValue, [l flagExecute [, p options]])

Arguments

connSQL::ConnectionCharacter

An open SQL::Connection object or connection string.

tableNameCharacter

The name of table to delete the record.

PrimaryKeyCharacter

The primary key of table. If primary key has multiple columns, enter a ||| delimited list of fields. If primaryKey is not specified (e.g., if "" is passed in), the table will be examined to determine the primary key.

PrimaryKeyValueAny Type

The primary key of record you want to delete. If the table has multiple primary key columns, enter a ||| delimited list of values. For example: 12034|||32

flagExecuteLogical

Default = .t.. If .f., the SQL is not executed. Instead, the options object shows the SQL that was generated.

optionsPointer

Required if flagExecute is set to .f.. Contains the SQL generated for the deleting the record.

Returns

ResultPointer

An object with the following properties:

errorLogical

If .t., an error occurred. Otherwise .f..

errorTextCharacter

A detailed description of the error - if any occurred.

sqlCharacter

The SQL that was generated to execute the delete.

ArgumentsCharacter

The XML arguments generated for the delete.

Description

Deletes a record in a SQL table.

Discussion

The sql_delete() function deletes a record from a SQL table.

dim conn as C = "::Name::AADemo-Northwind"
dim table as C = "Customers"
dim primaryKeyValue as C = "ALFKI"
dim execute as L = .f.
dim options as P

dim result as P

result = sql_delete(conn,table,"",primaryKeyValue,execute,options)

showvar(result)