【发布时间】:2021-08-10 04:21:44
【问题描述】:
我正在尝试从数据网格更新单元格值 但我不知道如何设置新的单元格值
private async void GridViewAccount_CellEditEnded(object sender,
Microsoft.Toolkit.Uwp.UI.Controls.DataGridCellEditEndedEventArgs e)
{
using (SqlConnection con = new SqlConnection((App.Current as App).Connectionstring))
{
SqlCommand command = new SqlCommand("sp_updateaccount", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@id", accountId);
command.Parameters.AddWithValue("@username", null); //how to get the new cell value
command.Parameters.AddWithValue("@password", null); //how to get the new cell value
command.Parameters.AddWithValue("@phone", null); //how to get the new cell value
command.Parameters.AddWithValue("@role", null); //how to get the new cell value
await con.OpenAsync();
await command.ExecuteNonQueryAsync();
con.Close();
accountToolRefresh();
}
}
【问题讨论】:
标签: c# xaml uwp win-universal-app windows-community-toolkit