注册

【DmProvider】DmCommand查询中包含未使用的参数报错数组索引越界。(“Index was outside the bounds of the array.)

DM_360065 2022/12/14 2100 1

【DM版本】:DM8(–03134283938-20221019-172201-20018)
【操作系统】:windows 10 64位
【CPU】:i5-10500
【问题描述】*:
【DmProvider】DmCommand查询中包含未使用的参数报错数组索引越界。(System.IndexOutOfRangeException:“Index was outside the bounds of the array.)
版本:DmProvider.1.1.0.11058
现象:
image.png
示例代码:

var sql = @"SELECT GUID FROM DUAL;"; using (var connection = new DmConnection(s_connectionString)) { connection.Open(); IDbCommand command = connection.CreateCommand(); command.CommandText = sql; var param = command.CreateParameter(); param.ParameterName = ":UserId"; param.DbType = DbType.String; param.Value = ("950ae1e0-2e77-4e54-b95a-a689d6fdc509"); command.Parameters.Add(param); // command.Parameters.Clear(); // 当执行语句中包含参数但是未使用就会抛异常 var reader = command.ExecuteReader(); Read(reader); }

堆栈信息:

System.IndexOutOfRangeException HResult=0x80131508 Message=Index was outside the bounds of the array. Source=DmProvider StackTrace: 在 Dm.DmReq.Execute(DmMsg msgIn, DmStatement stmt, DmInfo des, DmConnProperty connProperty) 在 Dm.DmCsi.ExecutePrepared(DmStatement stmt, DmInfo des) 在 Dm.DmStatement.ExecutePreparedQuery(CommandBehavior behavior) 在 Dm.DmCommand.ExecutePreparedQuery(CommandBehavior behavior) 在 Dm.DmCommand.do_ExecuteDbDataReader(CommandBehavior behavior) 在 Dm.DmCommand.ExecuteDbDataReader(CommandBehavior behavior) 在 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() ...
回答 0
暂无回答
扫一扫
联系客服