BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Doubt how to build a database access.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Students
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Apr 20, 2007 8:12 am    Post subject: Doubt how to build a database access. Reply with quote



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





PostPosted: Mon May 21, 2007 8:12 am    Post subject: Re: Doubt how to build a database access. Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Students All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.