Stuart McLachlan
stuart at lexacorp.com.pg
Tue Feb 5 17:11:40 CST 2008
I think you need to follow with kunderT.Update to update the underlying database from the
TableAdapter.
On 5 Feb 2008 at 18:02, Gustav Brock wrote:
> Hi Stuart et al
>
> No there is no GUI, just code.
> I have some code like this. It add rows but will not save them to the database table:
>
> VrsSourceTableAdapters.DataTableKundeTableAdapter kundeAdapterS =
> new VrsSourceTableAdapters.DataTableKundeTableAdapter();
> VrsSource.DataTableKundeDataTable kunderS;
>
> VrsTargetTableAdapters.DataTableKundeTableAdapter kundeAdapterT =
> new VrsTargetTableAdapters.DataTableKundeTableAdapter();
> VrsTarget.DataTableKundeDataTable kunderT;
>
> kunderS = kundeAdapterS.GetDataVrsKunder();
> kunderT = kundeAdapterT.GetDataVrsKunder();
>
> foreach (VrsSource.DataTableKundeRow kundeRowS in kunderS)
> {
> Console.WriteLine("Kunde: " + kundeRowS.navn + "");
> Console.WriteLine(" Kundenr: " + kundeRowS.kundeNr + "");
> // Mark row as modified.
> kundeRowS.SetModified();
> kunderT.ImportRow(kundeRowS);
> }
>
> Console.WriteLine("s: " + kunderS.Count.ToString());
> Console.WriteLine("t: " + kunderT.Count.ToString());
>
> kundeAdapterT.FillVrsKunder(kunderT);
>
> Target table is residing in MSDE.
> Count of s returns the count of records to add.
> Count of t returns existing records + count of records to add.
>
> What am I missing?
>
> /gustav
>
>
> >>> stuart at lexacorp.com.pg 05-02-2008 00:06:55 >>>
> Do you mean have the user physically browse through the rows looking for specific records?
>
> If that is the case, I would probably go with a DatagridView bound to the source data.
> When the user selects a row (double click, highlight and click a button or whatever), read the
> row data and feed it to a TableAdapter.Insert on the target table.
>
>
> On 4 Feb 2008 at 18:41, Gustav Brock wrote:
>
> > Hi all
> >
> > I have created two tableadapters, a source and a target, and need to
> > browse through the source looking for rows and, when a row meeting
> > some conditions is found, copy this to the target. What is the best
> > method?
> >
> > /gustav
>
>
>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>