Update access bug

This commit is contained in:
sunkaixuan 2022-02-26 22:29:35 +08:00
parent 524637c2d7
commit 6e9dcadc86
3 changed files with 5 additions and 4 deletions

View File

@ -74,9 +74,10 @@ namespace OrmTest
var dt = db.Ado.GetDataTable("select 1"); var dt = db.Ado.GetDataTable("select 1");
//Create tables //Create tables
db.CodeFirst.InitTables(typeof(OrderItem),typeof(Order)); Console.WriteLine(db.CurrentConnectionConfig.IsAutoCloseConnection);
db.CodeFirst.InitTables(typeof(OrderItem));
var id = db.Insertable(new Order() { Name = "order1", CustomId = 1, Price = 0, CreateTime = DateTime.Now }).ExecuteReturnIdentity(); var id = db.Insertable(new Order() { Name = "order1", CustomId = 1, Price = 0, CreateTime = DateTime.Now }).ExecuteReturnIdentity();
Console.WriteLine(db.CurrentConnectionConfig.IsAutoCloseConnection);
//Insert data //Insert data
db.Insertable(new OrderItem() { OrderId = id, Price = 0, CreateTime=DateTime.Now }).ExecuteCommand(); db.Insertable(new OrderItem() { OrderId = id, Price = 0, CreateTime=DateTime.Now }).ExecuteCommand();
Console.WriteLine("#### SqlSugarClient End ####"); Console.WriteLine("#### SqlSugarClient End ####");

Binary file not shown.

View File

@ -341,7 +341,7 @@ namespace SqlSugar.Access
private void Close(bool isOpen) private void Close(bool isOpen)
{ {
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection = true && isOpen) if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection&& isOpen)
{ {
this.Context.Ado.Connection.Close(); this.Context.Ado.Connection.Close();
} }
@ -350,7 +350,7 @@ namespace SqlSugar.Access
private bool Open() private bool Open()
{ {
var isOpen = false; var isOpen = false;
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection = true && this.Context.Ado.Connection.State == ConnectionState.Closed) if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection&& this.Context.Ado.Connection.State == ConnectionState.Closed)
{ {
this.Context.Ado.Connection.Open(); this.Context.Ado.Connection.Open();
isOpen = true; isOpen = true;