Re: reflect changes in data bound control when underlying data table changes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Ji,
Thanks for the solution. Actually I was also doing the same 3 things, but I was doing it at a wrong place and at wrong time. Thanks a lot.

Secondly, is it possible to achieve this result without calling Update on the route table? I want to give the user an option to save/reject the changes.

Lastly, I want to find out a way in which if a dock number say 5 doesn't exist anywhere in the route table, update the lane table and set the dock to 0 for which the value was 5. There are two ways to do this.
1) By writing direct SQL command. But this will require to first update the lane table, then update the dock and re-fill the lane table.
2) Traverse all the rows & columns in the lane table in the data set and update the value.

But these are not efficient enough. Is there any better way to do this?

Thanks & Regards,
Ashutosh

v-jzho@xxxxxxxxxxxxxxxxxxxx wrote:
Hello Ashutosh,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou [MSFT] and I will be working on this issue with you.

Actually the comboBox's value list will update automatically if its DataSource gets changed. In our scenario, we set the dump_docks as the DataSource. Thus, in order to make the comboBox's value list update, we firstly need to update the dump_docks table. As you described, this table's data is filled from the route table by using the select statement "select distinct dock from route order by dock". So, after we add a new row to the table route, we need to the following things,

1.Call routeTableAdapter.Update() to commit the added row to the data base.

2.Call dummy_docks.Clear() function to clear all data in the dummy table

3.Use the select command "select distinct dock from route order by dock" to fill the dummy_docks table again.

The following are codes work fine on my side, please let me know if this works on your side.

private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'testDataSet.lanes' table. You can move, or remove it, as needed.
this.lanesTableAdapter.Fill(this.testDataSet.lanes);
// TODO: This line of code loads data into the 'testDataSet.route' table. You can move, or remove it, as needed.
this.routeTableAdapter.Fill(this.testDataSet.route);

this.routeTableAdapter.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand("select distinct dock from route order by dock",new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.TestConnecti
onString));
this.routeTableAdapter.Adapter.Fill(this.testDataSet.dummy_docks);

this.dataGridViewComboBox1.DataSource = this.testDataSet.dummy_docks;

this.dataGridViewComboBox1.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox1.DisplayMember = "dock";

this.dataGridViewComboBox2.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox2.DisplayMember = "dock";

this.dataGridViewComboBox3.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox3.DisplayMember = "dock";

this.dataGridViewComboBox4.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox4.DisplayMember = "dock";

this.dataGridViewComboBox5.DataSource = this.testDataSet.dummy_docks;
this.dataGridViewComboBox5.DisplayMember = "dock";
}

private void button1_Click(object sender, EventArgs e)
{
this.testDataSet.route.Rows.Add(new object[] {"r7", 4 });
this.routeTableAdapter.Update(this.testDataSet.route);
this.testDataSet.dummy_docks.Clear();
this.routeTableAdapter.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand("select distinct dock from route order by dock", new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.TestConnecti
onString));
this.routeTableAdapter.Adapter.Fill(this.testDataSet.dummy_docks);
}

Have a nice day, Ashutosh!

Best regards,
Ji Zhou (v-jzho@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: cdrom support with thinkpad x6 ultrabay
    ... extra usb ports, seems to pick up the ethernet port, but it fails to ... support in libata, but I'm not exactly sure what's needed. ... you either get the dock optical if you boot the machine ... I tried taking the acpi dock patch seperately out of the mm patchset by ...
    (Linux-Kernel)
  • Re: I just got done ordering a..............
    ... the boats of others, were safe and properly secured during the flooding. ... They welded a metal support pole with handle where the finger dock meets the ... seawall at the request of my wife as she is unsteady on her feet due to a ...
    (rec.boats)
  • RE: reflect changes in data bound control when underlying data table changes
    ... Thanks for using Microsoft Newsgroup Support Service, ... 3.Use the select command "select distinct dock from route order by dock" to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Dock building
    ... one will be supported by 15 gallon plastic drums. ... I use an old pontoon platform for my dock but I'm interested in the details ... need to put in a permanent short pier at the edge of the bank to support ... the pipes right out of the ground and bent everything to hell. ...
    (rec.boats.building)
  • Re: Docking Misery !! Please Help !!
    ... What I'm looking to do is add a feature so that the user ... > can dock the 'support' form within the 'main' form. ... IgnoreVal then Top:= aTop;) ... Then you can dock your form from within the main form ...
    (comp.lang.pascal.delphi.misc)