VB.NET & ODBC

Hi, I’m trying to connect to a Native Navision DB with the use of an ODBCdataAdapter. The connection works and I can see the tables, but when I try to query them I get the following error… Retrieving the schema for OdbcDataAdapter failed ERROR [IM001][Microsoft][ODBC Driver Manager] Driver does not support this function How can i resolve this ? Tia

owkay, guess nobody knows… 2nd question, does anyone have some example code how to program a DSN connection in VB.NET for accessing Navision native DB ? I do mean program the connection so the system dsn is created in de Data Sources Thanks

Hi, Some methods are not supported by C/ODBC. RecordCount, MovePrevious, and Bookmarks are some examples. I don’t know about .NET, but in ADO, there is a method called recordset.Supports that lets you find out if some properties/methods are supported. See here: Microsoft Learn: Build skills that open doors in your career You can use RecordCount and MovePrevious if you set the CursorLocation to adUseClient. This makes ADO loads all selected records into client’s memory and counts the records and allows you to freely move across all records, i.e., simulates a rich environment. If you want to update any records, make sure that you have a backup just in case something wrong happens, such as updating all records with the same value if you only intended to modify one record. The default CursorLocation is adUseServer. This means that the records are created at the server and stored there. This is faster, but RecordCount and MovePrevious are not supported in this mode. RecordCount will return -1 in this case. Also, in this mode, C/ODBC supports only adOpenForwardOnly CursorType, and if you change CursorType to anything, C/ODBC will set it back to adOpenForwardOnly after you open the recordset without warning. This is perfectly fine in ADO. See here: Microsoft Learn: Build skills that open doors in your career

quote:


If a provider does not support the requested cursor type, it may return another cursor type. The CursorType property will change to match the actual cursor type in use when the Recordset object is open. To verify specific functionality of the returned cursor, use the Supports method. After you close the Recordset, the CursorType property reverts to its original setting.


The above means that you can’t auto-link to a datagrid for example unless you set the CursorLocation to adUseClient. 2nd question: Make a DSN entry yourself and click on the Company dialog. If the list of companies shows up, you know that C/ODBC was installed correctly and it’s ready to use…