QODBC connection using Visual Studio 2008 |
Author |
Message |
|
Posted : 2008-01-08 02:38:36 |
I am trying to use QODBC connection using Visual Studio 2008.
The 2.1 Compatibility is unchecked.
Test Connection works fine. Server Explorer Data Connections works fine.
When I go to Add New Data Source...
Database [NEXT]
Select ODBC.QODBC connection [NEXT]
I get this Error....
An error occured while retrieving the information from the database:
Selecting objects of type 'Procedure' is not supported.
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-01-08 13:36:06 |
You should still be able to connect to the ODBC data source using the OdbcConnection class (http://msdn2.microsoft.com/en-us/library/system.data.odbc.odbcconnection.aspx).
The following code is the minimal code required to create a DataSet from the SQL statement and attaches the dataset to a DataGrid:
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=QuickBooks 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 dgDataGrid.DataBind() 'May or maynot be required depending on where you put this code. |
|
|
|
|
Posted : 2008-06-28 11:30:50 |
My installation produces the same results.
I attempt to add a new Data Source [Database / ODBC..QODBC / New Connection / Data source: Microsoft ODBC Data Source / Use user or system data source name: QuickBooks Data / Test Connection -> Test connection succeeded. / OK / Next > / Next > / Retrieving Database information. / An error occurred while retrieving the information form the database: Selecting objects of type 'Procedure' is not supported.
__________________________________
I then attempt to run the suggested "minimal code required", above.
Dim cnQODBC As System.Data.Odbc.OdbcConnection
cnQODBC.Open()
It fails with this exception: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
__________________________________
The code from the QODBDemo vb project (I downloaded and built in VS 2008) also fails.
This line (131) of QODBCDemo.vb fails (Private msodbcConnection As Microsoft.Data.Odbc.OdbcConnection):
msodbcConnection = New OdbcConnection()
Below is the exception:
Unable to find an entry point named 'InterlockedIncrement' in DLL 'kernel32.dll'.
The source is: Microsoft.Data.Odbc |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-06-28 11:45:35 |
|
|
|
|
Posted : 2008-06-30 22:40:39 |
I believe VS2008 sp1 is still Beta. I hope my QODBC 30 trial will still have some time left when Microsoft releases the final version. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-07-01 10:47:40 |
You can still use an expired QODBC evaluation with any of the QuickBooks Sample Company files. It just won't open real company files. |
|
|
|
|
Posted : 2008-08-06 01:57:42 |
I just installed Visual Studio 2008 sp1 beta and I still get:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
The VB Demo still works, though. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-08-06 09:42:55 |
Please contact Microsoft support regarding the Visual Studio sp1 beta. |
|
|
|
|
Posted : 2008-08-13 04:11:05 |
SOLUTION (found without MIcrosoft support, thank you): Specify x86 as Target CPU in Visual Studio 2008.
Change project properties | Advanced Compile Options... | Target CPU | x86
When this was done, the sample code (below) worked.
- Paul
Private msodbcConnection As Microsoft.Data.Odbc.OdbcConnection
Private Sub btnGetData_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetData.Click
Dim myConnectionString As String
myConnectionString = "DSN=" & Trim(txtDSNSelect.Text)
Try
If (msodbcConnection Is Nothing) Then
msodbcConnection = New OdbcConnection()
End If
If (msodbcConnection.ConnectionString <> myConnectionString) Then
msodbcConnection.Close()
msodbcConnection.ConnectionString = myConnectionString
msodbcConnection.Open()
End If
Catch
MsgBox("Invalid DSN Name: " & Err.Description)
txtDSNSelect.Focus()
Exit Sub
End Try
Try
Dim msodbcEmployeeDA As New OdbcDataAdapter("SELECT * FROM Employee", msodbcConnection)
Dim msodbcEmployeeDS As New DataSet()
msodbcEmployeeDA.Fill(msodbcEmployeeDS, "Employee")
dgQODBCTable.DataSource = msodbcEmployeeDS
dgQODBCTable.DataMember = "Employee"
Catch
MsgBox("Invalid Grid Stuff" & Err.Description)
End Try
End Sub
|
|
|
|
|
Posted : 2008-08-13 06:54:44 |
The explanation there was: "There is not a 64 bit version of jet that is why you get that error. To force your app to use the 32 bit change the target cpu to x86 in the advanced compiler options."
So, I cann't honestly say I did not use Microsoft Support. I pray at the alter of Google. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-08-13 08:21:40 |
Our praise and thanks to the Google Gods! |
|
|
|
|
Posted : 2008-09-19 05:59:21 |
I'm trying to find out if the automatic Data Source creation works in VS 2008 i.e. one won't get the error:
An error occured while retrieving the information from the database:
Selecting objects of type 'Procedure' is not supported.
Thanks
Doug
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-09-22 08:40:10 |
|
|
|