Multiple-step OLE DB operation generated errors

2019-07-04 12:43发布

问题:

I am running a simple FillSchema from a Netezza data source

dss = new DataSet();
ad = new OleDbDataAdapter(cmd);
ad.SelectCommand = new OleDbCommand("SELECT * FROM " + objTable.name);
ad.SelectCommand.Connection = cn;
ad.FillSchema(dss, SchemaType.Source);

I get the following error:

System.Data.OleDb.OleDbException: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
   at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
   at System.Data.Common.DbDataAdapter.FillSchemaInternal(DataSet dataset, DataTable datatable, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillSchema(DataSet dataSet, SchemaType schemaType, IDbCommand command, String srcTable, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillSchema(DataSet dataSet, SchemaType schemaType)
   at IMS.DF2.IMSCubeGenerator.IMSCube.AddTableToDatasourceView(table objTable) in C:\DIUP\DF2\IMSCubeGenerator\IMSCube.cs:line 902

What am I doing wrong here?

How can I get to the errors underneath (Check each OLE DB status value)?

回答1:

What's your connection string?

It will be either your Driver, your Cursor or security (I had the same problem using Integrated Security).

Changing this to a username/password fixed my issue.

See here, here and here for more info.



标签: c# oledb netezza