I usually do web programming but have a requirement for a windows form in this project I'm working on now.
I'm using SubSonic to get a list of jobs and load a combobox:
JobCollection jobs = new JobCollection().Load();
cboJobs.DisplayMember = "Name";
cboJobs.ValueMember = "Id";
cboJobs.DataSource = jobs;
When the user selects an item and clicks the search button I need to query the database using the job "Id" field.
TransactionCollection transactions = new TransactionCollection();
if (!String.IsNullOrEmpty(txtTransactionId.Text))
{
transactions.Where("id", txtTransactionId.Text);
}
else
{
transactions.Where("raw_data", Comparison.Like, "%" + txtFind.Text + "%");
}
transactions.Where("job_id", Convert.ToInt32(cboJobs.SelectedItem));
transactions.Load();
The line that is having the problem is the one that goes "Convert.ToInt32(cboJobs.SelectedItem)".
How do I get the job id versus the name?