Subject | Data Aware Controls and Insertion question |
---|---|
Author | Daniel Jimenez |
Post date | 2004-10-11T00:18:58Z |
Hi,
To familiarise myself with IBObjects, I am writing a very simple application
that will allow users to Search, Edit and Insert records on a single table
in a DB.
I also decided to use data-aware controls for Search, and Edit using a
TIB_Cursor combined with a TIB_CursorGrid. For insertion I have setup a
TIB_Query combined with TIB_Edit components.
The application has a DataModule which contains:
TIB_Connection
TIB_Transaction
TIB_Cursor with a TIB_DataSource (The DataSet property is the
TIB_Cursor) and a TIB_CursorGrid
TIB_Query with a TIB_DataSource (The DataSet property is the
TIB_Query)
My question is regarding the insertion of new records into the single Table
of the DB using the TIB_Edit components through the TIB_Query.
I have set up the DataSource property (to point to the correct
TIB_DataSource, as well as a the DataField property of the TIB_Edit to point
to the field(s) of the DB table.
In the TIB_Query - SQL - UpdateSQL - InsertSQL I have defined the following
SQL statement:
INSERT INTO LOGPAS(
R_CREATED_BY,
R_LOGIN,
R_PASSWORD,
R_URL,
R_SHARED,
R_PRIMARY,
R_SECONDARY,
R_COMMENTS)
VALUES (
:R_CREATED_BY,
:R_LOGIN,
:R_PASSWORD,
:R_URL,
:R_SHARED,
:R_PRIMARY,
:R_SECONDARY,
:R_COMMENTS)
I have set all the properties of the TIB_Edit components to allow for
insertion. However, when I run the application, I am NOT able to
place/write/insert data into the TIB_Edit component fields, as they appear
to be ReadOnly. However, I have triple check to ensure that all appropriate
properties and flags as set so that insertion of data is allowed.
My main ambition is to learn how to correctly use this package, as opposed
to getting the application to just work. Thus I would like to know what is
the "Correct" way to insert records into a table with in a DB.
(1) Should I use Data-aware components? Or just use the standard VCL Edit
components with code susch as:
DataModule->TIB_Query->FieldByName("FIELD_NAME")->AsString =
FVariable;
(2) Should I be using the TIB_Query - SQL - UpdateSQL - InsertSQL
functionality?
Thank you
Daniel
____________________________
Comvision Pty. Ltd.
www.comvision.net.au
[Non-text portions of this message have been removed]
To familiarise myself with IBObjects, I am writing a very simple application
that will allow users to Search, Edit and Insert records on a single table
in a DB.
I also decided to use data-aware controls for Search, and Edit using a
TIB_Cursor combined with a TIB_CursorGrid. For insertion I have setup a
TIB_Query combined with TIB_Edit components.
The application has a DataModule which contains:
TIB_Connection
TIB_Transaction
TIB_Cursor with a TIB_DataSource (The DataSet property is the
TIB_Cursor) and a TIB_CursorGrid
TIB_Query with a TIB_DataSource (The DataSet property is the
TIB_Query)
My question is regarding the insertion of new records into the single Table
of the DB using the TIB_Edit components through the TIB_Query.
I have set up the DataSource property (to point to the correct
TIB_DataSource, as well as a the DataField property of the TIB_Edit to point
to the field(s) of the DB table.
In the TIB_Query - SQL - UpdateSQL - InsertSQL I have defined the following
SQL statement:
INSERT INTO LOGPAS(
R_CREATED_BY,
R_LOGIN,
R_PASSWORD,
R_URL,
R_SHARED,
R_PRIMARY,
R_SECONDARY,
R_COMMENTS)
VALUES (
:R_CREATED_BY,
:R_LOGIN,
:R_PASSWORD,
:R_URL,
:R_SHARED,
:R_PRIMARY,
:R_SECONDARY,
:R_COMMENTS)
I have set all the properties of the TIB_Edit components to allow for
insertion. However, when I run the application, I am NOT able to
place/write/insert data into the TIB_Edit component fields, as they appear
to be ReadOnly. However, I have triple check to ensure that all appropriate
properties and flags as set so that insertion of data is allowed.
My main ambition is to learn how to correctly use this package, as opposed
to getting the application to just work. Thus I would like to know what is
the "Correct" way to insert records into a table with in a DB.
(1) Should I use Data-aware components? Or just use the standard VCL Edit
components with code susch as:
DataModule->TIB_Query->FieldByName("FIELD_NAME")->AsString =
FVariable;
(2) Should I be using the TIB_Query - SQL - UpdateSQL - InsertSQL
functionality?
Thank you
Daniel
____________________________
Comvision Pty. Ltd.
www.comvision.net.au
[Non-text portions of this message have been removed]