mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Update OleDb
This commit is contained in:
parent
8aa6beee1e
commit
ff6b157b36
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user