Sorry for the delay in following up to your response - I had trouble
creating the objects in a simple app that would replicate the error.
Until I get that finished, here is the code I am using to put data into the
dataview
private void buttonAdd_Click(object sender, System.EventArgs e)
{
DataSetGolfPool.PicksRow dr = this.DataSetGolfPool.Picks.NewPicksRow();
dr.poolie_ID=Convert.ToInt32(this.ComboBoxPoolies.SelectedValue);
dr.tournament_ID=Convert.ToInt32(this.ComboBoxTournaments.SelectedValue);
dr.golfer_ID=Convert.ToInt32(this.ListBoxGolfers.SelectedValue);
dr.fullName=Convert.ToString(this.ListBoxGolfers.SelectedItem);
this.DataSetGolfPool.Picks.AddPicksRow(dr);
}
The row filter I am using:
this.DataViewPicks.RowFilter= String.Concat( "poolie_id=",
this.ComboBoxPoolies.SelectedValue, " AND tournament_id=",
this.ComboBoxTournaments.SelectedValue);
The ListBox is bound with the following properties:
this.ListBoxPicks.DataSource = this.DataViewPicks;
this.ListBoxPicks.DisplayMember = "fullName";
this.ListBoxPicks.Location = new System.Drawing.Point(616, 80);
this.ListBoxPicks.Name = "ListBoxPicks";
this.ListBoxPicks.Size = new System.Drawing.Size(160, 108);
this.ListBoxPicks.TabIndex = 4;
this.ListBoxPicks.ValueMember = "id";
//
// SqlDataAdapterPicks
//
this.SqlDataAdapterPicks.DeleteCommand = this.sqlDeleteCommand2;
this.SqlDataAdapterPicks.InsertCommand = this.sqlInsertCommand2;
this.SqlDataAdapterPicks.SelectCommand = this.sqlSelectCommand2;
this.SqlDataAdapterPicks.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Picks", new
System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("id", "id"),
new System.Data.Common.DataColumnMapping("poolie_ID", "poolie_ID"),
new System.Data.Common.DataColumnMapping("tournament_ID", "tournament_ID"),
new System.Data.Common.DataColumnMapping("golfer_ID", "golfer_ID")})});
Thanks
Derrick
Derrick said:
I will post it tomorrow AM
thx for the help.
Derrick
"Ying-Shen Yu[MSFT]" said:
Hi Derrick,
If DataSource and DisplayMember is set correctly,
this issue needs some further investigation, could you seperate this issue
into a small project and send me to let me take a look?
Also , Here is a small code snippet I tried without problem on my side, I
pasted it below, maybe you can tell me the difference between my test and
your reall scenario.
//I generated a strong-type dataset from Customer table,
//there are two fields in it, "CustID"(string), and "Name"(string)
//I only put a listbox and a button on the Form.
private void button1_Click(object sender, system.EventArgs e)
{
DataView dv = new DataView( dataSet11.Customers );
listBox1.DataSource = dv;
listBox1.DisplayMember = "CustID";
DataSet1.CustomersRow dr = dataSet11.Customers.NewCustomersRow();
dr["CustID"] = "1234";
dr["Name"] = "aaaa";
dataSet11.Customers.AddCustomersRow( dr );
}
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.