mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update OleDb
This commit is contained in:
@@ -39,7 +39,7 @@ namespace OrmTest
|
||||
//var x=db.Insertable(insertObjs).RemoveDataCache().IgnoreColumns(it=>it.CreateTime).UseParameter().ExecuteCommand();
|
||||
|
||||
//Ignore CreateTime
|
||||
db.Insertable(insertObj).IgnoreColumns(it => new { it.CreateTime }).ExecuteReturnIdentity();//get identity
|
||||
var x= db.Insertable(insertObj).IgnoreColumns(it => new { it.CreateTime }).ExecuteReturnIdentity();//get identity
|
||||
db.Insertable(insertObj).IgnoreColumns("CreateTime").ExecuteReturnIdentity();
|
||||
|
||||
//Only insert Name and Price
|
||||
|
@@ -72,8 +72,19 @@ namespace SqlSugar
|
||||
var result = 0;
|
||||
if (InsertBuilder.IsOleDb)
|
||||
{
|
||||
var isAuto = false;
|
||||
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection)
|
||||
{
|
||||
isAuto = true;
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
||||
}
|
||||
result = Ado.GetInt(sql.Split(';').First(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
result = Ado.GetInt(sql.Split(';').Last(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
if (isAuto)
|
||||
{
|
||||
this.Ado.Close();
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,8 +104,19 @@ namespace SqlSugar
|
||||
long result = 0;
|
||||
if (InsertBuilder.IsOleDb)
|
||||
{
|
||||
var isAuto = false;
|
||||
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection)
|
||||
{
|
||||
isAuto = true;
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
||||
}
|
||||
result = Convert.ToInt64(Ado.GetScalar(sql.Split(';').First(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
result = Convert.ToInt64(Ado.GetScalar(sql.Split(';').Last(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
if (isAuto)
|
||||
{
|
||||
this.Ado.Close();
|
||||
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user