TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Manu xaml
NA
19
0
Trying to add delete sql
Apr 10 2009 5:51 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");
}
}
}
Reply
Answers (
2
)
What is WPF's Equivalent
Just a Little Bit in a dilemma as to which book to buy for WPF