ADOConnection

Hi !

I have been asked to describe the different ADO commands parameters more explicit. So here are a detailed description for the used ADOconnection command in the articles Stored Procedures and Navision and ADO in Navision.

ADOconnection

ADOconnection is defined by the automation ‘Microsoft ActiveX Data Objects 2.8 Library’.Connection
It is used to create and open a connection to a data source (database).

In the mentioned articles we are using the following ADOconnection methods:

ADOconnection.Close

Closes a connection

ADOConnection.ConnectionString

Sets the details used for making a connection. It includes information about provider, server, database, userid and password.
Ex. 'PROVIDER=SQLOLEDB;SERVER=SQLServer;DATABASE=SQLDatabase;UID=SQLUserID;PWD=SQLPwd'

ADOConnection.Execute

Executes a query statement or a procedure. It takes the parameters commandtext, recordsaffected and option.

  • Commandtext is a sql query statement or a call to a stored procedure.
  • Recordsaffected returns the no. of records affected by the query.
  • Option is used to set how the provider should evaluate the commandtext parameters.

Valid option values are:

-1 adCmdUnspecified Command type argument not specified
1 adCmdText CommandText is a sql query script
2 adCmdTable CommandText is a table name whose columns are all returned by an internally generated SQL query
4 adCmdStoredProc CommandText is a stored procedure name
8 adCmdUnknown Type of command in the CommandText property is unknown.
256 adCmdFile CommandText is the file name of a persistently stored Recordset
512 adCmdTableDirect CommandText is a table name whose columns are all returned


ADOConnection returns a recordset.Ex. ADORecordSet := ADOConnection.Execute(SQLString,RecordsAffected,Option)

ADOConnection.Open

Opens a connection. If connectionsstring is not set, it can be used in the open command as a paramenter.

You can leave a response, or trackback from your own site.

Leave a Reply


× seven = 56