none
Help enabling "Top n" phrase. Supported using MSDASQL provider to a linked DB in Management Studio but not in .NET OdbcConnection. RRS feed

  • Question

  • Help enabling "Top n" phrase. Supported using MSDASQL provider to a linked DB in Management Studio but not in .NET OdbcConnection.

    I am using SQL Management Studio to a linked Pervasive database, the connection in properties states it is an "OLE DB Provider for ODBC Drivers" connection. When I run a query with a top n phrase within Management Studio, it works. But if I write a simple program to connection with

    System.Data.Odbc.OdbcConnection(

     

    @"Provider=MSDASQL;DSN=DBALocal;Trusted_Connection=yes;");

    it will not be able to parse the top n phrase. If I switch to using System.Data.OleDb with connection and command I will get this exception:

    "The .Net Framework Data Provider for OLEDB (System.Data.OleDb) does not support the Microsoft OLE DB Provider for ODBC Drivers (MSDASQL). Use the .Net Framework Data Provider for ODBC (System.Data.Odbc)."

    Thank you,

    Dave

     

    • Moved by Bob Beauchemin Tuesday, June 8, 2010 9:00 PM Moved to a more appropriate forum (From:.NET Framework inside SQL Server)
    Tuesday, June 8, 2010 4:48 PM

Answers

  • MSDASQL is an OLEDB to ODBC driver bridge, so essentially it's an OLEDB provider. Unfortunately it is not supported by .NET, but the bridge isn't really necessary since you can connect directly using System.Data.Odbc and the Pervasive ODBC driver. I've not used Pervasive before but I would suspect the connection string would look something like the following:

    PervasiveConnection = New Odbc.OdbcConnection("Driver={Pervasive ODBC Client Interface};ServerName=myServerAddress;dbq=@dbname;")
    PervasiveConnection.Open()

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, June 9, 2010 1:52 PM

All replies

  • MSDASQL is an OLEDB to ODBC driver bridge, so essentially it's an OLEDB provider. Unfortunately it is not supported by .NET, but the bridge isn't really necessary since you can connect directly using System.Data.Odbc and the Pervasive ODBC driver. I've not used Pervasive before but I would suspect the connection string would look something like the following:

    PervasiveConnection = New Odbc.OdbcConnection("Driver={Pervasive ODBC Client Interface};ServerName=myServerAddress;dbq=@dbname;")
    PervasiveConnection.Open()

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, June 9, 2010 1:52 PM
  • Hi,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions?  Paul's post is very helpful on this case.    

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, June 15, 2010 1:35 AM
    Moderator