Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Fill datasource what are binded to control what located on different form!!!

Fill datasource what are binded to control what located on different form!!!

Scheduled Pinned Locked Moved C#
helpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ElCachubrey
    wrote on last edited by
    #1

    Hi all. In my application i have one data table what can be binded to control on one form and can be filled on another form. this.cLIENTBindingSource.DataSource = this.dataSet1.CLIENT; .... this.comboBox1.DataSource = this.cLIENTBindingSource; In proper moment i press a button to make refilling of CLIENT data table. private void simpleButton1_Click(object sender, EventArgs e) { this.cLIENTTableAdapter.Fill(this.dataSet1.CLIENT); } In this case all work fine! :-D But when i bind this data table to control on one form and fill this one on other form like this: Form 1: this.cLIENTBindingSource.DataSource = this.dataSet1.CLIENT; .... this.comboBox1.DataSource = this.cLIENTBindingSource; .... private void simpleButton1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); Form2.Show(this.cLIENTTableAdapter, this.dataSet1.CLIENT) } Form 2: private void simpleButton1_Click(object sender, EventArgs e) { _dataAdapter.Fill(_dataTable); } internal void ShowDialog(System.Data.Common.DbDataAdapter DataAdapter, System.Data.DataTable DataTable, System.Windows.Forms.BindingSource BindingSource) { _dataAdapter = DataAdapter; _dataTable = DataTable; this.ShowDialog(); } In this case all sad. :(( Fill is make vary slow and even may fail. Where is problem here and what i can do to resolve it??? THANK

    W 1 Reply Last reply
    0
    • E ElCachubrey

      Hi all. In my application i have one data table what can be binded to control on one form and can be filled on another form. this.cLIENTBindingSource.DataSource = this.dataSet1.CLIENT; .... this.comboBox1.DataSource = this.cLIENTBindingSource; In proper moment i press a button to make refilling of CLIENT data table. private void simpleButton1_Click(object sender, EventArgs e) { this.cLIENTTableAdapter.Fill(this.dataSet1.CLIENT); } In this case all work fine! :-D But when i bind this data table to control on one form and fill this one on other form like this: Form 1: this.cLIENTBindingSource.DataSource = this.dataSet1.CLIENT; .... this.comboBox1.DataSource = this.cLIENTBindingSource; .... private void simpleButton1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); Form2.Show(this.cLIENTTableAdapter, this.dataSet1.CLIENT) } Form 2: private void simpleButton1_Click(object sender, EventArgs e) { _dataAdapter.Fill(_dataTable); } internal void ShowDialog(System.Data.Common.DbDataAdapter DataAdapter, System.Data.DataTable DataTable, System.Windows.Forms.BindingSource BindingSource) { _dataAdapter = DataAdapter; _dataTable = DataTable; this.ShowDialog(); } In this case all sad. :(( Fill is make vary slow and even may fail. Where is problem here and what i can do to resolve it??? THANK

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      This doesn't quite make sense. In case 1 you fill dataset and in case 2 you fill datatable. Also in case 2 the code is executed based on user input (button click) so it's not immediate. Perhaps you should explain a little bit more what you are trying to achieve.

      The need to optimize rises from a bad design. My articles[^]

      E 1 Reply Last reply
      0
      • W Wendelius

        This doesn't quite make sense. In case 1 you fill dataset and in case 2 you fill datatable. Also in case 2 the code is executed based on user input (button click) so it's not immediate. Perhaps you should explain a little bit more what you are trying to achieve.

        The need to optimize rises from a bad design. My articles[^]

        E Offline
        E Offline
        ElCachubrey
        wrote on last edited by
        #3

        This just a sample. Actually i use one static dataset in my application and can display in two diffrent windows forms (suppose parent and child) same data table in the same time, all work fine, till i start to fill this data table in one form, in this case Fill operation are maked very slow. But when i use so one form and fill data table exatamente in it all work fine. Example above just describe this situation.

        W 1 Reply Last reply
        0
        • E ElCachubrey

          This just a sample. Actually i use one static dataset in my application and can display in two diffrent windows forms (suppose parent and child) same data table in the same time, all work fine, till i start to fill this data table in one form, in this case Fill operation are maked very slow. But when i use so one form and fill data table exatamente in it all work fine. Example above just describe this situation.

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          There could be two reasons. Either the statement used for fill is slow or the existing binding is making it slow. Before filling the dataset, remove any bindings to it and rebind after the fill. Perhaps that would help.

          The need to optimize rises from a bad design. My articles[^]

          E 1 Reply Last reply
          0
          • W Wendelius

            There could be two reasons. Either the statement used for fill is slow or the existing binding is making it slow. Before filling the dataset, remove any bindings to it and rebind after the fill. Perhaps that would help.

            The need to optimize rises from a bad design. My articles[^]

            E Offline
            E Offline
            ElCachubrey
            wrote on last edited by
            #5

            Yes its a solution. But why when i fill this table in the same form where binded my control (either without rebinding) all work fine, but when in another all work very slow????? Thats the Point.

            modified on Monday, October 27, 2008 3:52 AM

            W 1 Reply Last reply
            0
            • E ElCachubrey

              Yes its a solution. But why when i fill this table in the same form where binded my control (either without rebinding) all work fine, but when in another all work very slow????? Thats the Point.

              modified on Monday, October 27, 2008 3:52 AM

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              As I said in the first post, the scenarios are not the same. In your first example you fill the dataset. So it seems that you don't have a datatable in the dataset, but it's created during fill. In the second example, you already have a datatable and you're filling it. So it makes me wonder if you have existing event handlers, binding etc. attached to the datatable. If so, they can be the cause to the slow fill. Especially if binding is involved since existing binded objects must be refreshed when binding is done. This wouldn't be the case in example 1. Without seeing the actual situation, it's merely guessing. However, the filling speed should be equal in both cases if the query is the same and the 'surroundings' are the same (eventhandlers etc)

              The need to optimize rises from a bad design. My articles[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups