Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Executes the specified query, SQL statement, stored procedure, or provider-specific text.

 

Syntax

 

nRecordsEffected = <ADODB_Connection>.ExecuteCmd(sCommandText [, lOptions])

 

Returns

 

Number of records that the operation affected

 

Parameters

 

Name

Type

Optional

Meaning

sCommandText

String

No

A String value that contains the SQL statement, stored procedure, a URL, or provider-specific text to execute.

Optionally, table names can be used but only if the provider is SQL aware. For example if a table name of "Customers" is used, ADO will automatically prepend the standard SQL Select syntax to form and pass "SELECT * FROM Customers" as a Transact-SQL statement to the provider.

lOptions

Number

Yes

A value that indicates how the provider should evaluate the CommandText argument.

Can be a bitmask of one or more CommandTypeEnum or ExecuteOptionEnum values.

 

If lOptions is not specified, %adExecuteNoRecords will be used as default value

 

 

Remarks

 

Using the ExecuteCmd method on a ADODB_Connection object executes whatever query you pass to the method in the CommandText argument on the specified connection.

 

Restrictions

 

See also

 

<ADODB_Connection>.Execute

 

Examples

 

Uses "Console"

Uses "ADODB"

 

'---Declare a new pConnection variable and instantiate it in one line

Dim pConn As New ADODB_CONNECTION

 

pConn.Provider = "Microsoft.Jet.OLEDB.4.0"

pConn.Open(APP_SourcePath & "Biblio.mdb")

 

PrintL pConn.Provider

Printl pConn.ConnectionString

 

If pConn.State = %ADSTATEOPEN Then

 

  Dim sSql  As String

  dim nRec  as Long

 

  '---

  sSql = "Update Authors set [Year Born] = 2017 Where Au_ID = 1"

  PrintL "Query is:", sSql

 

  nRec = pConn.ExecuteCmd(sSql)

  printl "Records effected (valid only for update queries):", nRec

 

  pConn.Close

 

end If

 

WaitKey

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software