VB.NET Connection Fail |
Author |
Message |
|
Posted : 2006-11-10 14:19:12 |
This is the connection I am trying to establish in Visual Studio 2005 using VB.NET:
Dim cnQODBC As System.Data.Odbc.OdbcConnection
Dim daQODBC As System.Data.Odbc.OdbcDataAdapter
Dim dsQODBC As System.Data.DataSet
cnQODBC = New System.Data.Odbc.OdbcConnection("DSN=WMS Data")
cnQODBC.Open()
daQODBC = New System.Data.Odbc.OdbcDataAdapter("SELECT ListID, FullName, CompanyName FROM Customer", cnQODBC)
dsQODBC = New System.Data.DataSet
daQODBC.Fill(dsQODBC)
dgDataGrid.DataSource = dsQODBC
I receive the following Error:
System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.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.Odbc.OdbcConnection.Open()
at EarthLite_QBooks.frmQBooks.LoadCust() in Z:\Earthlite Work\Project\EarthLite-QBooks\EarthLite-QBooks\Form1.vb:line 15
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-10 17:17:39 |
Is the Data Source Name "DSN=WMS Data" a system DSN on the local workstation you are using? Can you connect to WMS Data using VB Demo? |
|
|
|
|
Posted : 2006-11-11 12:41:13 |
It is a User DSN and yes it works with VB Demo. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-11 18:17:18 |
WMS Data needs to be a System DSN |
|
|
|
|
Posted : 2006-11-12 15:02:39 |
Then how do I make it a System DSN when QuickBooks made it a User DSN and with in the ODBC manager of XP it will only make System DSN for SQL Sever databases. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-13 09:41:32 |
|
|
|
|
Posted : 2006-11-13 10:54:04 |
The Quick Books Driver does not show up as one that I may add. I have unistalled the qodbc.exe and have reinstalled and this still does not correct the issue. I'm logged in as the Admin. It appears that the driver for QuickBooks is not a recognized driver to be added as a system DSN, I only have it available as an User DSN. Thanks for your help. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-13 11:05:24 |
The "Select a driver" screen is the same for User, File or System DSNs. Check the Driver tab.
|
|
|
|
|
Posted : 2006-11-13 15:31:57 |
I now have created a System DSN called (WMSConn) and I still get the same results. It works with the VB Demo if I use the create new connection by selecting the DSN, but if I use the connection String ("Provider=MSDASQL.1;Persist Security Info=False;Data Source=WMSConn;OLE DB Services=-2;") it fails. What is accurring with in the VB Demo that makes it work but not from my simple connection code in VB.NET?
Dim cnQODBC As System.Data.Odbc.OdbcConnection
Dim daQODBC As System.Data.Odbc.OdbcDataAdapter
Dim dsQODBC As System.Data.DataSet
cnQODBC = New System.Data.Odbc.OdbcConnection(""Provider=MSDASQL.1;Persist Security Info=False;Data Source=WMSConn;OLE DB Services=-2;")
cnQODBC.Open()
daQODBC = New System.Data.Odbc.OdbcDataAdapter("SELECT ListID, FullName, CompanyName FROM Customer", cnQODBC)
dsQODBC = New System.Data.DataSet
daQODBC.Fill(dsQODBC)
dgDataGrid.DataSource = dsQODBC
I receive the following Error:
System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.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.Odbc.OdbcConnection.Open()
at EarthLite_QBooks.frmQBooks.LoadCust() in Z:\Earthlite Work\Project\EarthLite-QBooks\EarthLite-QBooks\Form1.vb:line 15
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-13 15:54:58 |
|
|
|
|
Posted : 2006-11-14 11:45:10 |
I have and it fails the same way as the orginal one. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-14 11:51:55 |
The error is saying that the "Data Source Name" isn't found, normally this only happens to Terminal or Citrix users. |
|
|
|
|
Posted : 2006-11-14 12:32:45 |
I'm not using neither one. Just trying to setup a connection on my local computer that has QuickBooks 7.0 (trial version) installed on. Can you show the example connection string that the VB Demo uses since the DSN works fine there with no problem? |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-11-14 13:58:40 |
|
|
|