Jump to content


Photo

NextDBGrid with ClientDataSet and DataSource


  • Please log in to reply
12 replies to this topic

#1 def00

def00
  • Members
  • 8 posts

Posted 25 September 2016 - 10:58 PM

Hi Guys,
 
I Have a problem with the NextDBGrid and ClientDataSet.
 
The NextDBGrid Columns Have Create to DesignTime and the ClientDataSet to RunTime.
 
The Last 4 Columns are Checkbox Fieds.
I have  the CheckboxFields Option ValueChecked und ValueUnChecked with True and False set without ''.
 
I have In my ClientDataSet are the last 4 fields as Boolean.
 
[Sourcecode]
  Max := 7;
  if not(Max < 0) then
  begin
    ClientDataSet2.Edit;
    for i :=0 to Max do
    begin
      ClientDataSet2.Append;
      ClientDataSet2.FieldByName('ID').AsInteger                             := i + 1;
      ClientDataSet2.FieldByName('Produktionsnummer').AsInteger := 11457 + i;
      ClientDataSet2.FieldByName('Auftragsnummer').AsString        := '1609-00' + IntToStr(i) + 'Pos.1';
      ClientDataSet2.FieldByName('Kunde').AsString                        := 'Imedco';
      ClientDataSet2.FieldByName('Artikel').AsString                         := '124.50' + IntToStr(i);
      ClientDataSet2.FieldByName('Anzahl').AsInteger                      := 12 + i;
      ClientDataSet2.FieldByName('Info1').AsString                           := 'Peraluman 100';
      ClientDataSet2.FieldByName('Info2').AsString                           := '3mm';
      ClientDataSet2.FieldByName('Scheren').AsBoolean                  := True;
      ClientDataSet2.FieldByName('Lasern').AsBoolean                    := False;
      ClientDataSet2.FieldByName('Stanzen').AsBoolean                  := True;
      ClientDataSet2.FieldByName('Kanten').AsBoolean                   := False;
      ClientDataSet2.FieldByName('Fladdern').AsBoolean                := True;
      ClientDataSet2.FieldByName('Schweissen').AsBoolean            := False;
    end;
    ClientDataSet2.Post;
    ed_Auftragsnummer.Text :=ClientDataSet2.FieldByName('Auftragsnummer').AsString;
  end;
[Sourcecode]


help me please ... Thank you

Attached Files



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 25 September 2016 - 11:42 PM

Hello Sir,

Sometimes, (based on previous experience with non-english set-up) user need to set localized true and false for ValueUnchecked and ValueUnchecked. Try to print on screen DisplayText of some of these fields. It will tell you what is used on your system.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 def00

def00
  • Members
  • 8 posts

Posted 25 September 2016 - 11:54 PM

Hello Sir,


I have a German System from Germany

I have the 'Checked and Unchecked'Value to German Changed.

The NextDBGrid showing nothing From ClientDataSet

The Topic http://www.bergsoft....?showtopic=1220,
Post #9 the Attachment can't be download

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 26 September 2016 - 12:22 AM

Hi,

Can you tell me if only checkbox are not displayed property, or no rows are shown?

It seems that first post have been corrupted. Maybe because used sourcecode tag, instead of code.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 12:41 AM

Hi,

Sourcecode for my ClientDataSet have been bbcode added.

It is a Test with 8 Record.

The Problem is, i have create on  DesignTime the Columns.
The NextDBGrid Showing are nothing from my ClientDataSet :(

But Why
please help me

procedure TMainForm.LoadEtiRecToDBGridBerg;
var
  i, Max : Integer;
begin
  Max := 7;
  if not(Max < 0) then
  begin

    ClientDataSet2.Edit;
    for i :=0 to Max do
    begin
      ClientDataSet2.Append;
      ClientDataSet2.FieldByName('ID').AsInteger                := i + 1;
      ClientDataSet2.FieldByName('Produktionsnummer').AsInteger := 11457 + i;
      ClientDataSet2.FieldByName('Auftragsnummer').AsString     := '1609-00' + IntToStr(i) + 'Pos.1';
      ClientDataSet2.FieldByName('Kunde').AsString              := 'Imedco';
      ClientDataSet2.FieldByName('Artikel').AsString            := '124.50' + IntToStr(i);
      ClientDataSet2.FieldByName('Anzahl').AsInteger            := 12 + i;
      ClientDataSet2.FieldByName('Info1').AsString              := 'Peraluman 100';
      ClientDataSet2.FieldByName('Info2').AsString              := '3mm';
      ClientDataSet2.FieldByName('Scheren').AsBoolean           := True;
      ClientDataSet2.FieldByName('Lasern').AsBoolean            := False;
      ClientDataSet2.FieldByName('Stanzen').AsBoolean           := True;
      ClientDataSet2.FieldByName('Kanten').AsBoolean            := False;
      ClientDataSet2.FieldByName('Fladdern').AsBoolean          := True;
      ClientDataSet2.FieldByName('Schweissen').AsBoolean        := False;
    end;
    ClientDataSet2.Post;
    ed_Auftragsnummer.Text :=ClientDataSet2.FieldByName('Auftragsnummer').AsString;
  end;
end;

//My Procedure to create Fields for my ClientDataSet
procedure TMainForm.CreateDataSetTableBerg;
begin
  ClientDataSet2.Active := False;
  with ClientDataSet2.FieldDefs do
  begin
    Clear;
    with AddFieldDef do
    begin
      Name     := 'ID';
      DataType := ftInteger;
    end;

    with AddFieldDef do
    begin
      Name     := 'Produktionsnummer';
      DataType := ftInteger;
    end;

    with AddFieldDef do
    begin
      Name     := 'Auftragsnummer';
      DataType := ftString;
      Size     := 30;
    end;

    with AddFieldDef do
    begin
      Name     := 'Kunde';
      DataType := ftString;
      Size     := 30;
    end;

    with AddFieldDef do
    begin
      Name     := 'Artikel';
      DataType := ftString;
      Size     := 30;
    end;

    with AddFieldDef do
    begin
      Name     := 'Anzahl';
      DataType := ftInteger;
    end;

    with AddFieldDef do
    begin
      Name     := 'Info1';
      DataType := ftString;
      Size     := 30;
    end;

    with AddFieldDef do
    begin
      Name     := 'Info2';
      DataType := ftString;
      Size     := 30;
    end;
    with AddFieldDef do
    begin
      Name     := 'Scheren';
      DataType := ftBoolean;
    end;
    with AddFieldDef do
    begin
      Name     := 'Lasern';
      DataType := ftBoolean;
    end;
    with AddFieldDef do
    begin
      Name     := 'Stanzen';
      DataType := ftBoolean;
    end;
    with AddFieldDef do
    begin
      Name     := 'Kanten';
      DataType := ftBoolean;
    end;
    with AddFieldDef do
    begin
      Name     := 'Fladdern';
      DataType := ftBoolean;
    end;
    with AddFieldDef do
    begin
      Name     := 'Schweissen';
      DataType := ftBoolean;
    end;
  end;
  ClientDataSet2.CreateDataSet;
  ClientDataSet2.Active := True;


#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 26 September 2016 - 12:46 AM

Hi Sir,

May I take one day to test it and see where is a error? Worked whole day on some other feature, and my mind will be better rested tomorrow (now is 23:45 here).
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 01:00 AM

Hi Sir,

May I take one day to test it and see where is a error? Worked whole day on some other feature, and my mind will be better rested tomorrow (now is 23:45 here).

Hi Sir,

 

I solved one Problem. :)

NextDBGrid DataAwareOption ¦ doAutoAssignFielName have it changed to True

The NextDBGrid Show the ClientDataSet first Fields but the checkbox Fields not :(

 

Ok.

 

Best Rigards



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 26 September 2016 - 01:24 AM

Good,

I will test it tomorrow and send you results as soon as possible.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 01:31 AM

Good,

I will test it tomorrow and send you results as soon as possible.

thank you very much
I go sleeping good Night :)



#10 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 06:30 PM

Hi, Sir

Problem with the Checkbox on the NextDBGrid is solved
NextGrid show the Checkbox Correctly :)

I have the ClientDataSet ftBoolean to ftInteger Changed.
NextDBGrid 'Checked' as Integer 1 and 'UnChecked' as Integer 0 :)

Thank you very much

 

the Picture

 

Attached File  checkbox.jpg   102.02KB   0 downloads



#11 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 08:41 PM

 
 
I have still one question :)
 
I want switchen the color between the lines.
I hope She have link , sample or Tutorial
I found nothing on this Site


#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 26 September 2016 - 09:44 PM

Hi,

Great news!

Maybe this event can help:
 
procedure TForm1.NextDBGrid1CellColoring(Sender: TObject; ACol,
  ARow: Integer; var CellColor, GridColor: TColor; CellState: TCellState);
begin
// Inspect ACol, ARow and set CellColor and GridColor
end;
or you can set GridLinesColor property of Grid for global value. Then you can adjust inside event.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#13 def00

def00
  • Members
  • 8 posts

Posted 26 September 2016 - 10:28 PM

Hi Sir,

 

I found this Topic http://www.bergsoft....p?showtopic=596

Post #4

is Perfect :)

 

Thank you






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users