📄 14.1.txt
字号:
Listing 14.1 Detecting DataSet Changes
private void dgProduct_CurrentCellChanged(object sender, System.EventArgs e)
{
if( productsDS1.HasChanges() )
{
statusBar1.Text = “Modified”;
}
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if( productsDS1.HasChanges() )
{
DialogResult result;
result = MessageBox.Show( this, “Would you like to save your changes?”,
“Northwind Products”, MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question );
if( result == DialogResult.Cancel )
{
e.Cancel = true;
return;
}
else if( result == DialogResult.No )
{
return;
}
else
{
sqlDataAdapter1.Update( productsDS1 );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -