none
OleDb data provider give error E_NOINTERFACE RRS feed

  • Question

  • c# code don't work:

    string connectionString = "Provider=OvHOleDbProv.OvHOleDbProv.1;Persist Security Info=True;User ID=user;Password=password;Data Source=192.168.7.96;Location="";Mode=ReadWrite;Extended Properties="";"; OleDbConnection _connection = new OleDbConnection(connectionString); _connection.Open(); DataTable schema = _connection.GetSchema("Tables"); // Exception see below

    _connection.Close();


    Exception:

    System.Data.OleDb.OleDbException (0x80004002): Сбой "OvHOleDbProv.OvHOleDbProv.1" без сообщения об ошибке, код результата: E_NOINTERFACE(0x80004002).
       в System.Data.OleDb.OleDbConnectionInternal.ProcessResults(OleDbHResult hr)
       в System.Data.OleDb.OleDbConnectionInternal.GetSchemaRowset(Guid schema, Object[] restrictions)
       в System.Data.OleDb.OleDbConnection.GetOleDbSchemaTable(Guid schema, Object[] restrictions)
       в System.Data.OleDb.OleDbMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
       в System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)
       в System.Data.ProviderBase.DbConnectionInternal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)
       в System.Data.OleDb.OleDbConnection.GetSchema(String collectionName, String[] restrictionValues)
       в System.Data.OleDb.OleDbConnection.GetSchema(String collectionName)
       в SourceModule.Ovation.ApiOvation.ExportSignals(String filename) в E:\tfs\vm-tfs\SAn\Source code\SourceModules\Ovation\Development\Version 2\SourceModule.Ovation\ApiOvation.cs:строка 58
       в SourceModule.Ovation.Program.Main(String[] args) в E:\tfs\vm-tfs\SAn\Source code\SourceModules\Ovation\Development\Version 2\SourceModule.Ovation\Program.cs:строка 20

    c# code work:

    string connectionString = "Provider=OvHOleDbProv.OvHOleDbProv.1;Persist Security Info=True;User ID=user;Password=password;Data Source=192.168.7.96;Location="";Mode=ReadWrite;Extended Properties="";";
    OleDbConnection _connection = new OleDbConnection(connectionString);
    _connection.Open();
    DataTable schema = _connection.GetSchema("Restrictions");
    _connection.Close();
    PS code work both:
    $connectionString='Provider=OvHOleDbProv.OvHOleDbProv.1;Persist Security Info=True;User ID=user;Password=password;Data Source=192.168.7.96;Location="";Mode=ReadWrite;Extended Properties="";' 
    $oCon = New-Object System.Data.OleDb.OleDbConnection $connectionString 
    $oCon.Open() 
    $schema = New-Object System.Data.DataTable
    $schema = $oCon.GetSchema("Tables") 
    $schema
    $schema = $oCon.GetSchema("Restrictions")
    $schema
    $oCon.Close()
    Restrictions output include collectionName "Tables".

    • Moved by Fei Hu Monday, March 19, 2018 8:00 AM Moved from C#
    Sunday, March 18, 2018 1:01 PM

Answers

  • The following code returns a list of tables in the database and save to xml:

    string connectionString = "Provider=OvHOleDbProv.OvHOleDbProv.1;Persist Security Info=True;User ID=user;Password=password;Data Source=192.168.7.96;Location=\"\";Mode=ReadWrite;Extended Properties=\"\";";
    OleDbConnection connection = new OleDbConnection(connectionString);
    _connection.Open();
    OleDbCommand command = new OleDbCommand() { Connection = connection, CommandText = "select TABLE_NAME from SYSTABLES where TABLE_TYPE='TABLE'" };
    OleDbDataReader datareader = command.ExecuteReader();
    DataTable data = new DataTable();
    data.Load(_datareader);
    data.TableName = "SYSTABLES"; // necessary for writing to xml
    data.WriteXml("tables.xml");
    connection.Close();

    Monday, March 26, 2018 8:25 AM

All replies

  • Where is the stacktrace and the inner.exception message that will show the error message if there is an inner.exception message?

    You are showing some code. Where is the try/catch to catch the exception and show the information I am talking about.

    ex.execption.message, ex.stacktrace and ex.inner.exception.message is what you should be trying to show.

    Sunday, March 18, 2018 2:30 PM
  • All this info in Exception block. 

    Ex.Message == "Сбой \"OvHOleDbProv.OvHOleDbProv.1\" без сообщения об ошибке, код результата: E_NOINTERFACE(0x80004002)."

    Ex.stacktrace == "   в System.Data.OleDb.OleDbConnectionInternal.ProcessResults(OleDbHResult hr)\r\n   в System.Data.OleDb.OleDbConnectionInternal.GetSchemaRowset(Guid schema, Object[] restrictions)\r\n   в System.Data.OleDb.OleDbConnection.GetOleDbSchemaTable(Guid schema, Object[] restrictions)\r\n   в System.Data.OleDb.OleDbMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)\r\n   в System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)\r\n   в System.Data.ProviderBase.DbConnectionInternal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)\r\n   в System.Data.OleDb.OleDbConnection.GetSchema(String collectionName, String[] restrictionValues)\r\n   в System.Data.OleDb.OleDbConnection.GetSchema(String collectionName)\r\n   в OvationMigrateUtil.Program.Main(String[] args) в E:\\git\\erokeme.visualstudio.com\\Utils\\Main\\OvationToSQLMigrateUtil\\OvationMigrateUtil\\OvationMigrateUtil\\Program.cs:строка 30"

    ex.InnerException == null;


    Sunday, March 18, 2018 2:50 PM
  • What type of database are you attempting to work on? I've never seen OvOleDbProv provider before.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Sunday, March 18, 2018 4:21 PM
  • Not even in my Yandex search engine

    :-)


    Success
    Cor

    Sunday, March 18, 2018 4:53 PM
  • Yeah... This is an early product of commercial development and, I doubt that it is freely available. 

    There is no documentation for this driver, unfortunately. 

    I think it does not matter. The question is, why does everything work in PS, and in the application on C# - no. What can be different?

    P.s.: I apologize for my english.

    Sunday, March 18, 2018 5:04 PM
  • Yeah... This is an early product of commercial development and, I doubt that it is freely available. 

    There is no documentation for this driver, unfortunately. 

    I think it does not matter. The question is, why does everything work in PS, and in the application on C# - no. What can be different?

    P.s.: I apologize for my english.

    Yea but how do you then know the problem is in .Net and not in that early product? It is strange that it happens sometimes.

    However, one thing I can think about are the underscore prefixes. Remove those. They are used as default field assignment for automatic properties. 


    Success
    Cor

    Sunday, March 18, 2018 5:24 PM
  • This code is part of my class, so I used underscore prefix. But even without underscores it does not work.

    Yes, the problem can be in the implementation of the provider. But in this case I can not fix anything. So I hope the problem is different, but my knowledge is not enough to fix it. In addition, everything works in the PS script, excel (using data source and select this oledb provider) :)

    Maybe there is another way to get a list of tables from the SQL database. But the support of the language SQL in the database is limited.

    Sunday, March 18, 2018 6:30 PM
  • Hi,

    This forum is discussing and asking questions about the C# programming language, IDE, libraries, samples, and tools.

    For your case is about third-party product, your thread will be moved to off-topic forum.

    Thank your for your understanding.

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 19, 2018 7:57 AM
  • Hi, 

    this question about OleDb of .Net, and why same code work in ps and don't work in c#. 

    Nevertheless, I found another way to solve the problem.

    Monday, March 26, 2018 8:25 AM
  • The following code returns a list of tables in the database and save to xml:

    string connectionString = "Provider=OvHOleDbProv.OvHOleDbProv.1;Persist Security Info=True;User ID=user;Password=password;Data Source=192.168.7.96;Location=\"\";Mode=ReadWrite;Extended Properties=\"\";";
    OleDbConnection connection = new OleDbConnection(connectionString);
    _connection.Open();
    OleDbCommand command = new OleDbCommand() { Connection = connection, CommandText = "select TABLE_NAME from SYSTABLES where TABLE_TYPE='TABLE'" };
    OleDbDataReader datareader = command.ExecuteReader();
    DataTable data = new DataTable();
    data.Load(_datareader);
    data.TableName = "SYSTABLES"; // necessary for writing to xml
    data.WriteXml("tables.xml");
    connection.Close();

    Monday, March 26, 2018 8:25 AM