FillByCountry From MSSQL
-
I want to do this: When I'll click at the CountryName column(England), I want redirect it to me in the new form where will be corresponding CityNames(London, Birmingem,Liverpool and etc) in countryForms I have: <pre> private void dataGridView1_DoubleClick(object sender, EventArgs e) { // here when I call Citys new City("I want Parameter here").showdialog(); //I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows) { int b = (int)item["ID"]; } } </pre> but it is not what I want :( In CityForms: <pre> private int CountryID; //Form1 f; public Cities(int countryID) { InitializeComponent(); CountryID = countryID; //f = new Form1(); } public void Cities_Load(object sender, EventArgs e) { this.citiesTableAdapter.Fill(storeHouseDataSet.Cities); this.citiesTableAdapter.FillByCountry(storeHouseDataSet.Cities, CountryID); } </pre>
C# Developer
-
I want to do this: When I'll click at the CountryName column(England), I want redirect it to me in the new form where will be corresponding CityNames(London, Birmingem,Liverpool and etc) in countryForms I have: <pre> private void dataGridView1_DoubleClick(object sender, EventArgs e) { // here when I call Citys new City("I want Parameter here").showdialog(); //I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows) { int b = (int)item["ID"]; } } </pre> but it is not what I want :( In CityForms: <pre> private int CountryID; //Form1 f; public Cities(int countryID) { InitializeComponent(); CountryID = countryID; //f = new Form1(); } public void Cities_Load(object sender, EventArgs e) { this.citiesTableAdapter.Fill(storeHouseDataSet.Cities); this.citiesTableAdapter.FillByCountry(storeHouseDataSet.Cities, CountryID); } </pre>
C# Developer
West1989 wrote:
//I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows) { int b = (int)item["ID"]; } } but it is not what I want
1. What is it that you do want? 2. Assuming you want 'b' to have some usable value, then you need to define b in the outer scope, and also break out of the loop when you hit the right value. Perhaps you could clarify your question?