Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with LINQ query
    primarykey
    data
    text
    <p>I'm trying to retrieve columns based on their corresponding key.</p> <p>"Select * from diamond where p_Id="+p_Id</p> <p>I followed MSDN sample and they were doing it like this way:</p> <pre><code> CurrencyManager cm = ((CurrencyManager)this.BindingContext[myDatabaseDataSet, "Items.ItemDiamond"]); IBindingList list = (IBindingList)cm.List; </code></pre> <p>but list's related view data only returns data of p_Id=1. What's wrong?.</p> <p>Full Code:</p> <pre><code> private void Viewdiamonds(int p_Id) { this.Cursor = Cursors.WaitCursor; frmDiamond frmd = new frmDiamond(); CurrencyManager cm = ((CurrencyManager)this.BindingContext[myDatabaseDataSet, "Items.ItemDiamond"]); IBindingList list = (IBindingList)cm.List; frmd.ShowDialog(p_Id, this, list); this.Cursor = Cursors.Default; } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1 &amp;&amp; e.RowIndex != -1 &amp;&amp; !dataGridView1.Rows[e.RowIndex].IsNewRow) { DataGridViewCell cell = this.dataGridView1[e.ColumnIndex - 1, e.RowIndex]; int p_Id = Convert.ToInt32(cell.Value); this.Viewdiamonds(p_Id); } } </code></pre> <p>Edit:</p> <p>I've two related columns, Items and Diamond. I've a datagridview control that display data from Items table. I added a column of type LinkView, so when the user clicks ViewDiamond, a new form pops up and display Diamonds related to that Item. I looked at MSDN DataGridView control sample, and they implemented that using the code above. I did some tweaks to the code to fit my application. What's the wrong with the code above? Because it seems its not able to display the data according to its relative p_Id. Or I think there is somthing wrong with the p_Id, no matter its value, Currency manager seems to retrieve only data corresponed to p_Id = 1.</p> <p>I hope this clarified the issue.</p>
    singulars
    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.
    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