Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
provider not registered on the local machine |
Author |
Message |
|
Posted : 2007-05-07 06:42:09 |
Just installed the demo and am attempting to use it from a ASP.NET Windows Forms app. I have configured and tested the QOBDC driver to connect to my database. However connecting programmatically fails:
string sConn = "Provider={QODBC Driver for QuickBooks};DSN=CartagoQB;";
OleDbConnection odb = new OleDbConnection( sConn );
odb.Open();
fails with "The '{QODBC Driver for QuickBooks}' provider is not registered on the local machine."
Thanks!
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2007-05-07 08:19:03 |
ASP.NET How to: Connect to an QODBC Database Using the SqlDataSource Control
You can use the SqlDataSource control to connect to any database that supports Open Database Connectivity (ODBC) by storing connection string information in the Web application's Web.config file and then referencing the connection string from your SqlDataSource control.
To configure a connection string for ODBC in the Web.config file Open the Web.config file in the root directory of your ASP.NET application. If you do not have a Web.config file, create one.
In the Configuration element, add a ConnectionStrings element if one does not already exist.
Create an add element as a child of the ConnectionStrings element, defining the following attributes:
name Set the value to the name that you want to use to reference the connection string.
connectionString Assign the connection string that is required by the database you are connecting to, setting the appropriate driver, server name, and authentication information.
providerName Assign the value "System.Data.Odbc", which specifies that ASP.NET should use the ADO.NET System.Data.Odbc provider when making a connection with this connection string.
The connection string configuration will be similar to the following example. In this example, the connection string values are used to connect to QuickBooks by using an ODBC provider.
<configuration> <connectionStrings> <add name="QODBCDataConnectionString" connectionString="DRIVER={QODBC Driver for QuickBooks};DFQ=D:\Data\em1996.qbw;SERVER=QODBC;UseDCOM=Y;OpenMode=F;" providerName="System.Data.Odbc" /> </connectionStrings> </configuration>
Save the Web.config file and close it.
To reference the ODBC connection string from a SqlDataSource control In the page in which you want to connect to the QODBC database, add a SqlDataSource control.
In the SqlDataSource control, specify the following properties:
SelectCommand Set to the query that you want to execute for this data control. The syntax of the query depends on the data source you are accessing.
ConnectionString Set to the name of the connection string that you created in the Web.config file.
ProviderName Set to the name of the provider that you specified in the Web.config file for the corresponding connection string.
Note: You can also define UpdateCommand, InsertCommand, and DeleteCommand properties. The SqlDataSource control supports commands and functionality not covered here.
The following example shows a SqlDataSource control configured to access the QODBC data source. In the example, the SelectCommand property is set to a SQL query.
<asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="Select * From Customer" ConnectionString="<%$ ConnectionStrings:QODBCDataConnectionString %>" ProviderName="<%$ ConnectionStrings:QODBCDataConnectionString.ProviderName %>" />
You can now bind other controls, such as the GridView control, to the SqlDataSource control.
|
|
|
|
|
Posted : 2007-05-08 01:34:33 |
Thank you for that. I have a couple other questions, if you like I can post separate messages. To wit:
- Does QODBC not recognize the QB Remote Server? The only way I was able to run was with the QB application actually running. I'd rather just have the service running. Attempting to run with the service get an error when QODBC executes BeginSession() b/c it does not pass in the name of the db. Is there something else I need to do?
- I'm not clear on licensing requirements, obviously you'd like 1 copy QODBC per physical machine. I'm fine with that for production environment however I develop on 2 machines, one at the office and one at home. Can a single license be shared by 2 development machines?
Thanks, it appears you have a great product from what I've seen so far.
Steve |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2007-05-08 09:35:10 |
QODBC can connect to QuickBooks in background mode by using the company file to use in the connection string, for example: DFQ=D:\Data\em1996.qbw, but the company file unattended mode must first work as per: How do I setup QODBC to auto-login into QuickBooks and start it if it's not running?
QODBC is licensed to each computer, in order to use QODBC on a computer at work and a computer at home requires two licenses to be purchased. |
|
|
|
|