代码采用 C# .NET 标准
var connectionString = $"<connection string here>";
var connection = new DB2Connection(connectionString);
connection.Open();
IDbCommand command = connection.CreateCommand();
string sqlStatement = "<a valid query goes here>";
command.CommandText = sqlStatement;
IDataReader dataReader = command.ExecuteReader();
var data = new DataTable();
data = dataReader.GetSchemaTable(); //This throws a NotSupportedException.
//data.Load(dataReader); //This should work, but the above line is what throws the exception, which is what this method is calling internally.
在未注释掉的最后一行抛出 NotSupportedException,并显示消息“不支持指定的方法”。
我安装了 IBM.Data.DB2.Core 的 1.2.2.100 版本,以及 11.1 版本的许可证。如果您需要更多上下文,请告诉我。
提前致谢。