我有一个针对 IBM AS/400 数据库的选择查询的 asp 站点。如果应用程序查询仅使用表中的一个列名,它会返回数据,但是如果我在查询中有多个列名,则会引发'Attempted to read or write protected memory. This is often an indication that other memory is corrupt'
错误消息。例如
SELECT ISDUI FROM PY.F55 <--returns data
or
SELECT ISEMAL FROM PY.F55 <--returns data
SELECT ISDUI, ISEMAL FROM PY.F55 <--error out
这是.net代码:
public int runDB(string cmd, string sub, ref DataSet ds, string type)
{
try
{
if (iDB2DataAdapter1 == null)
{
iDB2DataAdapter1 = new iDB2DataAdapter("", new iDB2Connection(G_AS400conn));
iDB2DataAdapter1.SelectCommand.CommandTimeout = 0;
}
if (iDB2DataAdapter1.SelectCommand.Connection.State != ConnectionState.Open)
iDB2DataAdapter1.SelectCommand.Connection.Open();
iDB2DataAdapter1.SelectCommand.CommandText = @cmd;
if (type == "S")
{
ds.Clear();
rows = iDB2DataAdapter1.Fill(ds);
}
else
{
rows = iDB2DataAdapter1.SelectCommand.ExecuteNonQuery();
}
return rows;
}
catch(Exception ex)
{
//log error message
}
}
有谁知道为什么会这样?
谢谢。