combobox is binded to a table upon result of a query
private void frmTaskAdd_Load(object sender, EventArgs e)
{
...
...
...
daTaskCombo = new System.Data.SqlClient.SqlDataAdapter("SELECT * FROM taskdescription WHERE shoretype = '" + result + "'", con);
dsTaskDescription = new DataSet("Task Description");
daTaskCombo.Fill(dsTaskDescription, "Task Desc Combo");
cmbActivityType.DataSource = dsTaskDescription.Tables["Task Desc Combo"];
cmbActivityType.DisplayMember = "description";
}
this is the SelectedIndexChanged event
private void cmbActivityType_SelectionchangeCommitted(object sender, EventArgs e)
{
strActivityType = cmbActivityType.SelectedItem.ToString();
string query = "description='" + strActivityType + "' AND shoretype='" + result + "'";
daTaskDescription = new System.Data.SqlClient.SqlDataAdapter("SELECT * FROM taskdescription", con);
daTaskDescription.Fill(dsTaskDescription, "TaskDescription");
DataRow[] drGetIndeksForActivityType = dsTaskDescription.Tables["TaskDescription"].Select(query);
foreach (DataRow drActivity in drGetIndeksForActivityType)
{
indeksActivityType = (int)drActivity["id"];
}
}
Please help. i have done debugging myself. tried some advices from forums thread but still failed.

New Topic/Question
Reply



MultiQuote





|