Board index » delphi » Getting Data aware controls to behave like non data aware controls.

Getting Data aware controls to behave like non data aware controls.

Hi All,
I am using ADOQuery to populate some data aware controls for viewing records
in an SQL Server 7 table.
For Viewing and moving around with DBNavigator, this is great.

I want to be able to add records to my table by clearing out the data aware
controls an populating them by typing from the keyboard.
I would then use a ADOStoredProc with the information typed into the
controls as parameters to insert records into my table.

The problem is, when I call the clear fields method of ADOQuery, the system
thinks that I am trying to clear the fields of an existing record. If I try
to disconect the datasource from the dataset, that disables the controls.

I am getting to the point where it want to just get rid of the data aware
controls and use regular edit controls.

For all you folks out there that are updating, deleting, and inserting
records with stored procs. Are you using data aware controls or regular
controls?

If the answer is data aware:
How do you temporarily disconnect them from their data sources so that they
will behave like a  non data aware controls when manipulating data with
stored procs?

Thanks, John

 

Re:Getting Data aware controls to behave like non data aware controls.


No, no, no. You don't need that. Use UpdateSQL component (the ADO variant).
UpdateSQL has three SQL properties, one for each operation -
insert,update,delete.
By default InsertSQL will look like
"INSERT INTO ATable (Field1,Field2,....) values (:Field1, :Field2,...)"
You can put ANYTHING in it, like a call to your procedure:
"EXEC MyInsertProc(:Field1,:Field2,....."
You can also use OnUpdateRecord event and use ADOStoredProc in it, if the
above EXEC doesn't work.
Now, instead of clearing data, you simply call ADOQuery.Insert.
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Quote
John Shearing wrote in message <8h9g0a$b...@bornews.borland.com>...
>Hi All,
>I am using ADOQuery to populate some data aware controls for viewing
records
>in an SQL Server 7 table.
>For Viewing and moving around with DBNavigator, this is great.

>I want to be able to add records to my table by clearing out the data aware
>controls an populating them by typing from the keyboard.
>I would then use a ADOStoredProc with the information typed into the
>controls as parameters to insert records into my table.

>The problem is, when I call the clear fields method of ADOQuery, the system
>thinks that I am trying to clear the fields of an existing record. If I try
>to disconect the datasource from the dataset, that disables the controls.

>I am getting to the point where it want to just get rid of the data aware
>controls and use regular edit controls.

>For all you folks out there that are updating, deleting, and inserting
>records with stored procs. Are you using data aware controls or regular
>controls?

>If the answer is data aware:
>How do you temporarily disconnect them from their data sources so that they
>will behave like a  non data aware controls when manipulating data with
>stored procs?

>Thanks, John

Re:Getting Data aware controls to behave like non data aware controls.


Hi Robert,
Calling ADOQuery.Insert solved my problem.
Thanks for your help, John

Re:Getting Data aware controls to behave like non data aware controls.


Quote
>> Use UpdateSQL component (the ADO variant).

what is this ?  There is no ADO component connectivity to an UpdateSQL
object

OR is there ?

Quote
Robert Cerny wrote in message <8hb7hj.ba...@neosys.xrs.si>...
>No, no, no. You don't need that. Use UpdateSQL component (the ADO variant).
>UpdateSQL has three SQL properties, one for each operation -
>insert,update,delete.
>By default InsertSQL will look like
>"INSERT INTO ATable (Field1,Field2,....) values (:Field1, :Field2,...)"
>You can put ANYTHING in it, like a call to your procedure:
>"EXEC MyInsertProc(:Field1,:Field2,....."
>You can also use OnUpdateRecord event and use ADOStoredProc in it, if the
>above EXEC doesn't work.
>Now, instead of clearing data, you simply call ADOQuery.Insert.
>--
>----------------------
>Regards
>Robert Cerny
>Remove both qwe when replying
>email: robert.qwe.ce...@neosys.xrs.qwe.si

>No questions via email, unless explicitly invited.
>John Shearing wrote in message <8h9g0a$b...@bornews.borland.com>...
>>Hi All,
>>I am using ADOQuery to populate some data aware controls for viewing
>records
>>in an SQL Server 7 table.
>>For Viewing and moving around with DBNavigator, this is great.

>>I want to be able to add records to my table by clearing out the data
aware
>>controls an populating them by typing from the keyboard.
>>I would then use a ADOStoredProc with the information typed into the
>>controls as parameters to insert records into my table.

>>The problem is, when I call the clear fields method of ADOQuery, the
system
>>thinks that I am trying to clear the fields of an existing record. If I
try
>>to disconect the datasource from the dataset, that disables the controls.

>>I am getting to the point where it want to just get rid of the data aware
>>controls and use regular edit controls.

>>For all you folks out there that are updating, deleting, and inserting
>>records with stored procs. Are you using data aware controls or regular
>>controls?

>>If the answer is data aware:
>>How do you temporarily disconnect them from their data sources so that
they
>>will behave like a  non data aware controls when manipulating data with
>>stored procs?

>>Thanks, John

Other Threads