26.12.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 19 行
TXT
19 行
Listing 26.12 Updating a SQL Server CE Database
private void btnChange_Click(object sender, System.EventArgs e)
{
DataGridCell currentCell;
string currentCellData;
// Get the text to put into the current cell.
currentCellData = tbNewValue.Text;
// Get the current cell.
currentCell = dataGrid1.CurrentCell;
// Set the current cell’s data.
dataGrid1[currentCell.RowNumber,currentCell.ColumnNumber] = currentCellData;
// update the data source
DataRow updateRow =
catalogDataSet.Tables[“Catalog”].Rows[dataGrid1.CurrentRowIndex];
updateRow[“Title”] = dataGrid1[dataGrid1.CurrentRowIndex,1];
updateRow[“Artist”] = dataGrid1[dataGrid1.CurrentRowIndex,2];
sqlDataAdapter.Update( catalogDataSet, “Catalog” );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?