Xbasic

SQL::InsertStatementExecute Method

Syntax

Result_Flag as L = Execute([SQLConnection as SQL::Connection | SQLConnectionString as C] [, Arguments as SQL::Arguments | Arguments as C])

Arguments

Result_Flag

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

<SQL::InsertStatement>

A SQL::InsertStatement object.

SQLConnection

Optional. A SQL::Connection object with a defined .ConnectionString property.

Arguments

Optional. A connection string.

Description

Execute the current statement using the current or passed connection.

Discussion

The .Execute() method insert 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::InsertStatement.SQLStatement property. Optionally providing argument values as an object or as XML. Note: Argument values are merged with those already set on the query.

Example

dim conn as SQL::Connection
dim connString as C
dim ins as SQL::InsertStatement
dim sql_insert as C
connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"
sql_insert = "insert into customer (firstname, lastname, bill_city, bill_postal_code,bill_state_region) values ('George', 'Jones', 'Arlington', '02000', 'VA')"
? conn.open(connString)
= .T.
? ins.parse(sql_insert)
= .T.
? ins.execute(conn)
= .T.

See Also