help could use some examples.

From: Skybuck Flying (nospam_at_hotmail.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 07:21:43 +0200

Delphi's help could use some SQL examples

Since I find the help lacking... I have to gather all kinds of bits and
pieces how it works all over the place.

Just a few simple examples would have been enough.

Like executing sql statements

Getting the results, navigating it

All via source code... not via the data controls those are easy.

:)

Like.

1. How do I execute sql statements ?
2. How do I know how many records are in data set ?
3. How do I get the contents of it ?

These are all simple questions yet it is hard to figure out in the help.

This is how far I got

First using ADOTable nope that's not then using ADOCommand nope that's not
it.

Then using ADOQuery... yes this is the good component it's generic.

// close it first
    ADOQuery1.Close;
// set paramters;
    ADOQuery1.Parameters.ParamValues[ 'GameName' ] := EditGameName.Text;

Don't use SQL.Add or you ll keep adding stuff and gives errors.
    ADOQuery1.SQL.Text := 'SELECT GameName FROM TableGame WHERE
GameName=:GameName';

// Open it
    ADOQuery1.Open;

// number of results
    ShowMessage( IntToSTr( ADOQuery1.RecordCount ) );

The help talks about ResultSets... there is no ResultSet property !!! that's
just misleading..

Now I probably have to use methods like next, first etc and FieldByName to
get results...

Cya.