SVN r1116
SVN-Revision: r1116
This commit is contained in:
@@ -260,6 +260,23 @@ namespace Lskj.Core
|
||||
adapter.SelectCommand = cmd;//创建对象,与sql命令对象绑定
|
||||
DataSet dataSet = new DataSet();
|
||||
adapter.Fill(dataSet, tabName);//填充数据。第二个参数是数据集中内存表的名字,可以与数据库中的不同
|
||||
if (dataSet.Tables.Count > 0 && commandParameters != null)
|
||||
{
|
||||
DataTable resultTable = dataSet.Tables[dataSet.Tables.Count - 1];
|
||||
object returnValue = resultTable.Columns.Contains("returnValue") ? resultTable.Rows[0]["returnValue"] : "";
|
||||
for (int i = 0; i < commandParameters.Length; i++)
|
||||
{
|
||||
DbParameter sqlParameter = commandParameters[i];
|
||||
if (sqlParameter.Direction == ParameterDirection.ReturnValue)
|
||||
{
|
||||
sqlParameter.Value = returnValue;
|
||||
}
|
||||
if (sqlParameter.Direction == ParameterDirection.Output)
|
||||
{
|
||||
sqlParameter.Value = resultTable.Rows[0][$"outputValue{i}"];
|
||||
}
|
||||
}
|
||||
}
|
||||
//adapter.FillSchema(dataSet, SchemaType.Mapped, tabName);
|
||||
set2 = dataSet;
|
||||
}
|
||||
@@ -342,6 +359,23 @@ namespace Lskj.Core
|
||||
adapter.SelectCommand = cmd;
|
||||
DataSet dataSet = new DataSet();
|
||||
adapter.Fill(dataSet, tabName);
|
||||
if (dataSet.Tables.Count > 0 && parameterValues != null)
|
||||
{
|
||||
DataTable resultTable = dataSet.Tables[dataSet.Tables.Count - 1];
|
||||
object returnValue = resultTable.Columns.Contains("returnValue") ? resultTable.Rows[0]["returnValue"] : "";
|
||||
for (int i = 0; i < parameterValues.Length; i++)
|
||||
{
|
||||
DbParameter sqlParameter = parameterValues[i];
|
||||
if (sqlParameter.Direction == ParameterDirection.ReturnValue)
|
||||
{
|
||||
sqlParameter.Value = returnValue;
|
||||
}
|
||||
if (sqlParameter.Direction == ParameterDirection.Output)
|
||||
{
|
||||
sqlParameter.Value = resultTable.Rows[0][$"outputValue{i}"];
|
||||
}
|
||||
}
|
||||
}
|
||||
set2 = dataSet;
|
||||
}
|
||||
catch
|
||||
@@ -377,7 +411,7 @@ namespace Lskj.Core
|
||||
adapter.SelectCommand = cmd;
|
||||
DataSet dataSet = new DataSet();
|
||||
adapter.Fill(dataSet);
|
||||
if (dataSet.Tables.Count > 0)
|
||||
if (dataSet.Tables.Count > 0 && commandParameters != null)
|
||||
{
|
||||
DataTable resultTable = dataSet.Tables[dataSet.Tables.Count - 1];
|
||||
int.TryParse(resultTable.Rows[0]["execcount"] + "", out num);
|
||||
@@ -455,7 +489,7 @@ namespace Lskj.Core
|
||||
adapter.SelectCommand = cmd;
|
||||
DataSet dataSet = new DataSet();
|
||||
adapter.Fill(dataSet);
|
||||
if (dataSet.Tables.Count > 0)
|
||||
if (dataSet.Tables.Count > 0 && commandParameters != null)
|
||||
{
|
||||
DataTable resultTable = dataSet.Tables[dataSet.Tables.Count - 1];
|
||||
int.TryParse(resultTable.Rows[0]["execcount"] + "", out num);
|
||||
@@ -821,7 +855,7 @@ namespace Lskj.Core
|
||||
cmd.Parameters.Add(parameter);
|
||||
if (connectionType == ConnectionType.DmServer)
|
||||
{
|
||||
cmd.CommandText = cmd.CommandText.Replace(parameter.ParameterName, $":{parameter.ParameterName.TrimStart('@')}");
|
||||
cmd.CommandText = Regex.Replace(cmd.CommandText, parameter.ParameterName, $":{parameter.ParameterName.TrimStart('@')}", RegexOptions.IgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user