Manu xaml

Manu xaml

  • NA
  • 19
  • 0

adding delete sQL

Apr 10 2009 5:53 AM
Hi,

I am new to WPF and in this example I am basically trying to add the following delete functionality. 

DELETE FROM InspectorTime  WHERE TimeID=@TimeID

Can anyone guide me?  Txs

Here's the xaml code:
<dg:DataGrid.Columns>
                <dg:DataGridTextColumn IsReadOnly="True" Header="" Binding="{Binding Path=TimeID}" Visibility="Hidden"    />
                <dg:DataGridTextColumn IsReadOnly="True" Header="Route Priority" Binding="{Binding Path=RoutePriority}" MinWidth="100" />
                <dg:DataGridTextColumn IsReadOnly="True" Header="Job Address" Binding="{Binding Path=JobAddress}" MinWidth="100" />
                <dg:DataGridTextColumn IsReadOnly="True" Header="Permit #"  Binding="{Binding Path=PermitNumber}" MinWidth="100" />
                <dg:DataGridTextColumn IsReadOnly="True" Header="Inspection Type"  Binding="{Binding Path=TimeOptionEntry}" MinWidth="100" />
                <dg:DataGridTextColumn IsReadOnly="True" Header="Start Time"  Binding="{Binding Path=StartTime}" MinWidth="100" />
                <dg:DataGridTextColumn IsReadOnly="True" Header="End Time"  Binding="{Binding Path=EndTime}" MinWidth="100" />
                <dg:DataGridTemplateColumn Header="Void" Visibility="Visible" MinWidth="50" MaxWidth="50" >
                    <dg:DataGridTemplateColumn.
CellTemplate>
                        <DataTemplate>
                            <Button Content="Void" Foreground="Black" FontSize="12" VerticalAlignment="Center" MaxWidth="50" Click="VoidButton_Click" Tag="{Binding Path=TimeID}" Uid="{Binding Path=TimeID}"  />
                        </DataTemplate>
                    </dg:DataGridTemplateColumn.CellTemplate>
                </dg:DataGridTemplateColumn>

            </dg:DataGrid.Columns>


Here's the ref code:

        private void VoidButton_Click(object sender, RoutedEventArgs e)
        {
           
            if (MessageBox.Show("Are you sure you want to void the time?", "Void Inspection", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            // delete SQL query
         {
            try
             {

                 MessageBox.Show("Information Updated.", "Update");
             }
             catch (Exception oEx)
             {
                 MessageBox.Show("Information not Updated.", "Update");
             }
       
          }
        }

Answers (1)