Script example

The following example uses objects from the Microsoft ADO Object Library to add a record displayed in the Buyers window of the Real Estate Sales Manager application to the “BuyerInfo” table created in the Script example.

local ADODB.Connection connection;
local ADODB.Recordset recordset;
local string query;
local string conString;

{Define the ADO connection string.}
conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\RESM\RESM.MDB";
query = "SELECT BuyerID FROM BuyerInfo";

{Create and open a connection.}
connection = new ADODB.Connection();

{Create and open a recordset.}
recordset = new ADODB.Recordset();
recordset.Open(query, connection, ADODB.adOpenDynamic,ADODB.adLockOptimistic);

{If the record isn’t displayed, warn the user. Otherwise, add the record to the table.}
if 'Buyer ID' = "" then
	warning "Please display a record in the Buyers window.";
	recordset.Fields.Item[0].Value = 'Buyer ID';
	recordset.Fields.Item[1].Value = 'Buyer First Name';
	recordset.Fields.Item[2].Value = 'Buyer Last Name';
	recordset.Fields.Item[3].Value = Phone;
end if;

{Close the recordset.}

{Close the connection.}

{Clear the variables.}
clear connection;
clear recordset;


Documentation Feedback