I have a SQL-database with several columns:
StartTime EndTime MsgType Description
DateTim2 DateTim2 2 Some Text
DateTim2 DateTim2 2 Some Text1
DateTim2 DateTim2 1 Some Text2
DateTim2 DateTim2 3 Some Text3
The column MsgType
can have a value of 1, 2 or 3. I'm making a search option box With WPF to filter on start/end time
and also want to filter with Msgtype
. The search option box has an apply button to execute the stored procedure. When MsgType = 0
the SP shows all returns all MsgTypes.
I have used Linq to SQL classes to get the stored procedure to work:
LinqDataContext dc = new LinqDataContext(Properties.Settings.Default.ConnectionString);
private void ApplyButton_Click(object sender, RoutedEventArgs e)
{
spGetHistoric.ItemsSource = dc.spMessages_GetHistoric(1033, BeginDate.SelectedDate, StopDate.SelectedDate, 0 <this is the msgType>);
}
When I manually set MsgType to one of the values it works fine, but how do i get it to work with a combobox?