我目前無主鍵寫法如下,進行資料表的新增或更新操作,但下面寫法如何設定日期時間格式,才能避免匹配不到資料問題,謝謝
var total = 0;
var fullTableName = GetFullTableName();
var dt = GetTableLayout(fullTableName);
var dcs = _sqlSugarClient.Utilities.DataTableToDictionaryList(dt);
var whereColumns = GetWhereColumns(); --array
var ignoreColumns = GetIgnoreColumns();
var dtResult = _sqlSugarClient
.Storageable(dcs, fullTableName)
.WhereColumns(whereColumns) --如何設定時間格式?避免匹配不到資料問題
.ToStorage();
var updateable = dtResult.AsUpdateable;
var insertable = dtResult.AsInsertable;
if (ignoreColumns?.Length > 0)
{
total = await updateable.IgnoreColumns(ignoreColumns)
.ExecuteCommandAsync();
total += await insertable.IgnoreColumns(ignoreColumns)
.ExecuteCommandAsync();
}
else
{
total = await updateable.ExecuteCommandAsync();
total += await insertable.ExecuteCommandAsync();
}
我目前無主鍵寫法如下,進行資料表的新增或更新操作,但下面寫法如何設定日期時間格式,才能避免匹配不到資料問題,謝謝 var total = 0; var fullTableName = GetFullTableName(); var dt = GetTableLayout(fullTableName); var dcs = _sqlSugarClient.Utilities.DataTableToDictionaryList(dt); var whereColumns = GetWhereColumns(); --array var ignoreColumns = GetIgnoreColumns();
var dtResult = _sqlSugarClient .Storageable(dcs, fullTableName) .WhereColumns(whereColumns) --如何設定時間格式?避免匹配不到資料問題 .ToStorage(); var updateable = dtResult.AsUpdateable; var insertable = dtResult.AsInsertable;
if (ignoreColumns?.Length > 0) { total = await updateable.IgnoreColumns(ignoreColumns) .ExecuteCommandAsync(); total += await insertable.IgnoreColumns(ignoreColumns) .ExecuteCommandAsync(); } else { total = await updateable.ExecuteCommandAsync(); total += await insertable.ExecuteCommandAsync(); }