[QODBC-Desktop] Sample code for ASP C# QODBC connection
Posted by brad waddell on 12 March 2009 05:21 PM
|
|
Sample Code for ASP C# QODBC ConnectionSteps to Creating Connection in C#Try adding a new data source to your project by selecting Data -> Add New Data Source -> Selecting Database -> Next Clicking on the New Connection... button -> Selecting Data Source: Microsoft ODBC Data Source -> clicking Continue -> Then selecting Use user or system data source name: QuickBooks Data -> Then press Test Connection. Possible ErrorBut you might get an error message from Microsoft Visual Studio that reads:
Note: You can connect to the ODBC data source using the OdbcConnection class (http://msdn2.microsoft.com/en-us/library/system.data.odbc.odbcconnection.aspx). Minimal Code RequiredThe 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 cnQODBC = New System.Data.Odbc.OdbcConnection("DSN=QuickBooks Data") daQODBC.Fill(dsQODBC) Related Link See also: See also the msdn .NET Framework Developer Center: http://msdn2.microsoft.com/en-us/library/system.stathreadattribute.aspx.
Note: ADODB works when you loop through the result and recordset via Recordset.MoveNext(), an additional query is made through QODBC for each record. These additional queries caused an additional 50 minutes of runtime for a 7000 invoice query. Comparison between ADODB and ODBC MethodNote: The first function below demonstrates the ADODB method that took ~1 hour. The second does the same thing with ODBC and takes less than a minute. ADODB Method [STAThread] ODBC Method [STAThread]
Keywords : C #, c%23 , c#.net, .net, c%23.net | |
|