mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update sqlite
This commit is contained in:
@@ -78,9 +78,9 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||||
{
|
{
|
||||||
foreach (var item in dictionary)
|
foreach (DataRow item in dt.Rows)
|
||||||
{
|
{
|
||||||
cmd.CommandText = this.Context.Insertable(item).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
|
cmd.CommandText = this.Context.Insertable(UtilMethods.DataRowToDictionary(item)).AS(dt.TableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", "");
|
||||||
i += await cmd.ExecuteNonQueryAsync();
|
i += await cmd.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,9 +117,9 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true)
|
||||||
{
|
{
|
||||||
foreach (var item in dictionary)
|
foreach (DataRow item in dt.Rows)
|
||||||
{
|
{
|
||||||
cmd.CommandText = this.Context.Updateable(item)
|
cmd.CommandText = this.Context.Updateable(UtilMethods.DataRowToDictionary(item))
|
||||||
.WhereColumns(whereColums)
|
.WhereColumns(whereColums)
|
||||||
.UpdateColumns(updateColums)
|
.UpdateColumns(updateColums)
|
||||||
.AS(dt.TableName).ToSqlString();
|
.AS(dt.TableName).ToSqlString();
|
||||||
|
@@ -18,7 +18,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class UtilMethods
|
public class UtilMethods
|
||||||
{
|
{
|
||||||
|
public static Dictionary<string, object> DataRowToDictionary(DataRow row)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
// 遍历所有列并将其添加到字典中
|
||||||
|
foreach (DataColumn column in row.Table.Columns)
|
||||||
|
{
|
||||||
|
dictionary.Add(column.ColumnName, row[column]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
public static IEnumerable<T> BuildTree<T>(ISqlSugarClient db,IEnumerable<T> list, string idName, string pIdName, string childName, object rootValue)
|
public static IEnumerable<T> BuildTree<T>(ISqlSugarClient db,IEnumerable<T> list, string idName, string pIdName, string childName, object rootValue)
|
||||||
{
|
{
|
||||||
var entityInfo = db.EntityMaintenance.GetEntityInfo<T>(); ;
|
var entityInfo = db.EntityMaintenance.GetEntityInfo<T>(); ;
|
||||||
|
Reference in New Issue
Block a user