Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing Data from datagridview to form C#
    primarykey
    data
    text
    <p>Hoping someone can shed some light on my problem. I followed the tutorial found here <a href="http://msdn.microsoft.com/en-us/library/ms171925(v=VS.100).aspx#Y3500" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms171925(v=VS.100).aspx#Y3500</a> and cannot get this to work. </p> <p>My code is as follows:</p> <pre><code> namespace CityCollectionCSharp { public partial class frmSwitch : Form { public frmSwitch() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'newCityCollectionDataSet.ClientTable' table. You can move, or remove it, as needed. this.clientTableTableAdapter.Fill(this.newCityCollectionDataSet.ClientTable); // TODO: This line of code loads data into the 'newCityCollectionDataSet.PropertyInformation' table. You can move, or remove it, as needed. this.propertyInformationTableAdapter.Fill(this.newCityCollectionDataSet.PropertyInformation); } private void propertyInformationDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { System.Data.DataRowView SelectedRowView; newCityCollectionDataSet.PropertyInformationRow SelectedRow; SelectedRowView = (System.Data.DataRowView)propertyInformationBindingSource.Current; SelectedRow = (newCityCollectionDataSet.PropertyInformationRow)SelectedRowView.Row; frmSummary SummaryForm = new frmSummary(); SummaryForm.LoadCaseNumberKey(SelectedRow.CaseNumberKey); SummaryForm.Show(); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { propertyInformationBindingSource.Filter = "ClientKey ='" + comboBox1.SelectedValue + "'"; } } } </code></pre> <p>That is for the first form and now the second form:</p> <pre><code> namespace CityCollectionCSharp { public partial class frmSummary : Form { public frmSummary() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'newCityCollectionDataSet.PropertyInformation' table. You can move, or remove it, as needed. this.propertyInformationTableAdapter.Fill(this.newCityCollectionDataSet.PropertyInformation); } internal void LoadCaseNumberKey(String CaseNumber) { propertyInformationTableAdapter.FillByCaseNumberKey(newCityCollectionDataSet.PropertyInformation, CaseNumber); } } } </code></pre> <p>I have the query set up as follows in the propertyInfromationTableAdapter :</p> <pre><code>SELECT CaseNumberKey, BRTNumber, ParcelNumber, Premises, ClientKey, ParcelNum, Registry, TaxAcctName, StreetCode, CoverDate, OrderDate, Assessment, TaxFrom, TaxTo, TaxOpen, WaterOpen, WaterAcct, WaterTo, WaterFrom, AssessedBeg, AssessedDim, SumNotes, Legal, TotalWater, TotalTax, Type, OPARec, OPADoc, OPADocNum, Recital, Num, Name, Direction, Unit, ProductKey, DateFinished, Finished, Paid, BD, BDPaid, Search, Exam FROM PropertyInformation WHERE (CaseNumberKey = @CaseNumberKey) </code></pre> <p>I cannot figure out for the life of me why this does not work as prescribed. When I click on a record it passes both records in the table and always has the first one in the boxes I have. I only know this as I left the bindingnavigator. Any help would be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload