Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troubleshooting ODBC Adapter Error

Status
Not open for further replies.

goolawah

Technical User
Jan 6, 2005
94
AU
I am trying to master creating an ODBC connection in a VB.Net project.

It was all working pretty well except that there were a couple of tables in a Pervasive ODBC Engine database that I could not load.

In trying to diagnose this problem and, in the process, I seem to have done something that now makes it impossible to configure the ODBC Data Adapter at all. When I try "Configure Data Adapter" I get the following message, before I get a chance to even select a Data Source -
ODBC_ERR.JPG

I have deleted all the ODBC Data Sources, except one. I have confirmed that it works by doing a Query in EXCEL. I cannot find any security settings that seem relevant, or any way of specifying a default data source or driver.

I would appreciate any help with resolving this error as I can't progress while it persists.

Thanks in anticipation...
 
The error occurs on a virgin (Windows Application)project with one virgin form. I went straight to ToolBox | Data | ODBCDataAdapter. The code generated by the ODBC Data Adapter, before the error message occurs, is -
Code:
Private Sub OdbcDataAdapter1_RowUpdated(ByVal sender _
    As System.Object, ByVal e _
    As System.Data.Odbc.OdbcRowUpdatedEventArgs) _
    Handles OdbcDataAdapter1.RowUpdated

    End Sub
There isn't much else.
 
Well, the message states it can not find the Data Source Name. Have you verified the datasource?
 
I have verified the datasource via an EXCEL query, and tested it successfully in the Windows ODBC Data Source Administrator. It the case the datasource refers to a Pervasive "named database" I have opened it in the Pervasive Control Centre and everything is normal.

When the error occurs in VB.Net, it is in a new project and have not yet specified the data source.

It almost seems as if, somewhere in VB.Net, it stores a "default data source" which is used when configuring a new Data Adaptor ina new project. If this referred to a data source I have deleted it would explain the error. However, I cannot find where such a default might be set.[bugeyed]
 
For the benefit of others who may encounter similar problems I believe I have found the answer. VB.net does indeed keep a list of previously used ODBC Data Sources so that, when creating a new Data Adapter, you have the option of selecting an existing Data Source or creating a new one. This seems to be an internal reference list, not based on the data sources that actually exist. If A data source in the list has been removed, you get the error message above.

I overcame the problem by re-creating the data sources I have previously used, and all was well. I have not yet discovered how to remove items from the Data Source list in VB.net and would appreciate any help anyone can offer on this.

Thanks. [wavey2]

 
You verified it in Excel, but what about in VB? Are you missing a declaration, a reference, etc?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top