Datatable clear

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • inadsad@hotmail.com

    #1

    Datatable clear

    Good day Group,
    I have a form with a datagrid and two buttons. On show button
    datagrid is populated with a datatable and on
    clear button datagrid is cleared. DataTable.Clear not only removes
    all of the data from the DataTable, it clears the dataset as well.
    Why datatable.clear sets dataset to 0 rows?

    Thanks
    Ian
  • Cor Ligthert[MVP]

    #2
    Re: Datatable clear

    Ian,

    Is the content of your dataset only one datatable, or more datatables which
    in fact reference all to the same?

    Cor

    <inadsad@hotmai l.comschreef in bericht
    news:adcd2d25-2755-46ab-9c16-d34efb33a6d9@i1 8g2000prn.googl egroups.com...
    Good day Group,
    I have a form with a datagrid and two buttons. On show button
    datagrid is populated with a datatable and on
    clear button datagrid is cleared. DataTable.Clear not only removes
    all of the data from the DataTable, it clears the dataset as well.
    Why datatable.clear sets dataset to 0 rows?
    >
    Thanks
    Ian

    Comment

    • inadsad@hotmail.com

      #3
      Re: Datatable clear

      Thanks Cor for your respone.

      It's one datatable as follows:

      adapter.Fill(da taset1)
      datatable1 = dataset1.Tables (0)
      DataGridView1.D ataSource = datatable1.Defa ultView

      Ian

      Comment

      • Cor Ligthert[MVP]

        #4
        Re: Datatable clear

        Ian,

        A dataset is just a wrapper around a datatable as it is only one.

        The advantage is than only that you can easily serialize a datatable to a
        XML file.

        Cor

        <inadsad@hotmai l.comschreef in bericht
        news:e0120ea1-806d-4544-b10c-318a9ad2f096@v2 6g2000prm.googl egroups.com...
        Thanks Cor for your respone.
        >
        It's one datatable as follows:
        >
        adapter.Fill(da taset1)
        datatable1 = dataset1.Tables (0)
        DataGridView1.D ataSource = datatable1.Defa ultView
        >
        Ian

        Comment

        • inadsad@hotmail.com

          #5
          Re: Datatable clear

          Thanks Cor for the clarification.

          Comment

          Working...