Browse Source

Optimize error messages

pull/27/head
sunkaixuan 2 years ago
parent
commit
d8e4bd8928
  1. 6
      Src/Asp.Net/SqlSugar/Realization/Oracle/OracleProvider.cs
  2. 7
      Src/Asp.NetCore2/SqlSugar/Realization/Oracle/OracleProvider.cs

6
Src/Asp.Net/SqlSugar/Realization/Oracle/OracleProvider.cs

@ -134,7 +134,13 @@ namespace SqlSugar
return sql; return sql;
} }
public override Action<SqlSugarException> ErrorEvent => it => {
if (it.Message != null && it.Message.Contains("无效的主机/绑定变量名"))
{
Check.ExceptionEasy(it.Message, $"错误:{it.Message},出现这个错的原因 可能是参数名为关键词(例如 @user ),或者SQL错误。");
}
};
public override void SetCommandToAdapter(IDataAdapter dataAdapter, DbCommand command) public override void SetCommandToAdapter(IDataAdapter dataAdapter, DbCommand command)
{ {
((OracleDataAdapter)dataAdapter).SelectCommand = (OracleCommand)command; ((OracleDataAdapter)dataAdapter).SelectCommand = (OracleCommand)command;

7
Src/Asp.NetCore2/SqlSugar/Realization/Oracle/OracleProvider.cs

@ -134,6 +134,13 @@ namespace SqlSugar
return sql; return sql;
} }
public override Action<SqlSugarException> ErrorEvent => it => {
if (it.Message != null && it.Message.Contains("无效的主机/绑定变量名"))
{
Check.ExceptionEasy(it.Message, $"错误:{it.Message},出现这个错的原因 可能是参数名为关键词(例如 @user ),或者SQL错误。");
}
};
public override void SetCommandToAdapter(IDataAdapter dataAdapter, DbCommand command) public override void SetCommandToAdapter(IDataAdapter dataAdapter, DbCommand command)
{ {

Loading…
Cancel
Save