I cannot seem to get my datagridview to update the database using LINQ. I
have my dbml set up and I can perform updates if I use textboxes.
Here is the situation:
combobox1 one populates combobox2 on a selected index change for combobox1
combobox2 populates the datagridview on a selected index change for combobox2
private void combobox2_SelectedIndexChanged(object sender, EventArgs e)
{
var MarkupsQuery = from dealer_markup in intData1.dealer_markups
where dealer_markup.category ==
cboCategoryFee.SelectedValue.ToString()
&& dealer_markup.schedule_id ==
cboCoveragesFee.SelectedValue.ToString()
&& dealer_markup.dealer_id ==
cboDealership.SelectedValue.ToString()
select dealer_markup;
dealer_markupsBindingSource.DataSource = MarkupsQuery;
}
//this returns the correct data
private void btnSubmit_Click(object sender, EventArgs e)
{
try
{
dealer_markupsDataGridView.Update();
intData1.SubmitChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "ERROR");
}
}
//this is where "Specified cast is not valid" error message is displayed
Thanks for the help!
v/r,
Jason