查询数据库时,net 5抛出异常如下:
One or more errors occurred. (BeginExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.
错误代码:
最佳解决方案
1、可以把查询放到事务外面完成
2、也可以直接原来的事务链接进行查询,比如 车辆信息哪里的代码