Search code examples
c#odbcquickbooksunhandled-exception

ODBC Connection String error - C#


Attempting a simple ODBC connection to QuickBooks 2017 and have been unable to connect.

This is my current(among many other attempts) connection string. connection string

This is OdbcException was unhandled error unhandled

Error Message: "An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in System.Data.dll

Additional information: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

Any input on where I'm going wrong is appreciated. Thank you.


Solution

  • here is a good site , where you can find help

    Long story short,

    Example of simple DSN

    sConnectString = "DSN=Quickbooks Data;OLE DB Services=-2;"
    

    Example of a DSNless connection string

    sConnectString = "Driver={QODBC Driver for QuickBooks};DFQ=C:\Users\Public\Documents\Intuit\QuickBooks\Sample Company Files\QuickBooks Enterprise Solutions 14.0\sample_service-based business.qbw;OpenMode=M;OLE DB Services=-2;"
    

    Example of using current ADO syntax

    sConnectString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=QuickBooks Data;OLE DB Services=-2;"
    

    Standard syntax

    "DRIVER={QODBC Driver for QuickBooks};SERVER=QODBC;DFQ=.;OLE DB Services=-2;OptimizerOn=No;"