 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Apr 20, 2007 8:12 am Post subject: Doubt how to build a database access. |
|
|
Hi!
I would like to have a little explanation on this database scenario here.
Lets say I have two tables on my database: Customers and Orders.
Customers
CustomerID Integer AutoIncrement
Name Varchar 50
Address Varchar 60
Phone Varchar 15
Orders
orderID INteger AutoIncrement
Product varchar 50
cust_ID Integer
This is my database.
On Delphi I have a sqlConnection,a sqlDataSet, a DataSetProvider and a
ClientDataSet. IF I put this sql statement inside the sqldataset commandtext
property :
SELECT * FROM CUSTOMERS C,ORDERS O
If I use a ClientDataSet and try to assign a value to all fields from both
tables will IT be possible?
ClientDataSet.append;
ClientDataSet1.fieldbyName('Name').asString := edtName.Text;
ClientDataSet1.fieldbyName('PHONE').asString := edtPhone.Text;
ClientDataSet1.fieldbyName(PRODUCT').asString := edtProduct.Text; // field
from orders table
ClientDataSet.Post;
ClientDataSet.ApplyUpdates(0);
Can I do that or I have to have 2 ClientDataSet one for Customer and another
for orders?
--
Obrigado,
Eduardo Tavares
www.EduardoTavares.com.br |
|
| Back to top |
|
 |
Robin Guest
|
Posted: Mon May 21, 2007 8:12 am Post subject: Re: Doubt how to build a database access. |
|
|
Hi Eduardo,
I am not entirely sure if your example will work, but I think there is a
better way: Use a TSQLQuery component and run 2 update queries.
--
Robin.
Australian Bridal Accessories := http://www.bridalbuzz.com.au
Turbo for Noobs (a work in progress) := http://turbofornoobs.blogspot.com/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|