🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database.dotnet
Article #561

Re: Datatable refresh with new datatable

#561
From: John Powell (Borland)
Date: Thu, 06 Jan 2005 17:09
35 lines
2257 bytes
Clear the DataTable column information if you are going to be using the same 
datatable for both queries.

MyDataTable.Columns.Clear();

Do this before filling the DataTable for the second time. Does this work for 
you?

./John

"Bob" <rcf2@email.com> wrote in message 
news:41dcb587$1@newsgroups.borland.com...
> (sorry about this cross post, but original was in wrong group)
>
> I have a datagrid that I populate with a datatable.  But, if I change
> the data in the datatable, the grid seems to just add the new columns
> to the display rather than "clearing" and updating with the new table
> data in the datatable.
>
> Basically:
>  Fill(dataTable) // fill with query 1
>  dataGrid.DataSource:= dataTable
>
>  dataTable.Close
>  Fill(dataTable) // fill table with query 2
>  dataGrid.Datasource:= dataTable
>
> The end result, has all the columns for query 1 and query 2 displayed.
> The query 1 columns are all "nil" of course but they are still shown.
>
> Is there a way to "Clear" the datagrid completely before assigning a
> new datasource?
>
> I have tried, dataTable.ResetBindings hoping that would work but it
> didn't 
Technical Details
Message-ID: <41dd70e1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41dcb587$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,957c64a5b6bd6a51
X-Google-Attributes: gid1effe6,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "John Powell \(Borland\)" <john.powell@nomail.com>
Newsgroups: borland.public.delphi.database.dotnet
References: <41dcb587$1@newsgroups.borland.com>
Subject: Re: Datatable refresh with new datatable
Date: Thu, 6 Jan 2005 09:09:55 -0800
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 10.143.13.39
Message-ID: <41dd70e1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105031393 10.143.13.39 (6 Jan 2005 09:09:53 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail