Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2015, 01:55 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Question Getting the best out of DBGrid

Objective to this project: - keep client records and send out invoices and print envelopes.

I have ADOConnection1, ADOTableClients, DataSourceClients all connected to my MS access DB file. No sweet.
I also have ADOConnection1, ADOTablePurchases, DataSourcePurchases
and ADOConnection1, ADOTableItems, DataSourceItems ready to operate.

My DBGrid1 connects to DataSourceClients and lists a break down of names and address details of clients with a Int64 ID number. I want to select a client from DBGrid.

My DBGrid2 is connected to DataSourcePurchases and only display purchases linked to a Purchases - field 'Clients ID' : Int64.
Purchases table is: - ID, Clients ID, Purchase 1........ Purchase 6: all Int64,. date: TDate, Payment made: Boolean, Sent: Boolean, Date: TDate, Item Total: Currency, GST: Currency, Total: currency.

Items table has: - ID: Int64, Item Name: String, Price: currency;

My questions
DBGrid2 Needs to: -
1/ Only display purchases linked by its Purchases - field 'Clients ID' : Int64 that matches Clients - 'ÍD' : Int64. Where do I make the match.

2/ Display item Name and price, and full price and I need to add the price up. I need a pull down menu to select the item in the DBGrid from Items Table for 6 perchance's.

3/ When I Have a DBEdit's I can make it select the table and field through DataSourceClients but how do I make a new entry into the table.
Should I be using TEdit's and enter it with code with a 'Insert' button. How do I access the fields.
I think I got to use ADOQuery but I have no idea what my Query code would look like.

4/ I've Written
Quote:
procedure TForm2.Button2Click(Sender: TObject);
Var NoteStream: TBlobStream;
begin
With MainUnit.Form1.ADOTableClients do
begin
// MainUnit.Form1.ADOTableClients.FieldValues
If InsertData then Append else Last;
FieldValues['Ist Names'] := Edit1StName.text;
FieldValues['Last Name'] := Edit2ndName.Text;
FieldValues['Street Addr'] := EditStAddr.Text;
FieldValues['City'] := EditCity.Text;
FieldValues['Provance'] := EditProvance.Text;
FieldValues['Zip Code'] := EditZipCode.Text;
FieldValues['Country'] := ComBoxCountry.Text;
// NoteStream := CreateBlobStream(FieldByName('Note'), bmReadWrite);
Post;
InsertData := False;
Button2.Caption := 'Inserted';
end;
end;
But Not got my BlobStream to work for TRichEdit, whats a good way

Editorials on subject are good too
I just got to find my way around these things.

Last edited by lexd; 08-09-2015 at 04:23 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.