Loading data from a database in user code

To create a database worksheet from user code, here's what you need to do:

  • Define an ODBC connection string (if you don't know the syntax of an ODBC connection string for your database, ConnectionStrings is a great reference). This is a simple example for SQL Server:
connectionString = "DRIVER={SQLServer};SERVER=myserver;DATABASE=mydb;UID=testuser;PWD=testpassword;"
  • Call workbook.AddWorksheetFromDB, which takes the name for the worksheet, the connection string, the query to produce the data, and whether the first row of the resulting worksheet should be a header row populated from the query's field names:
workbook.AddWorksheetFromDB("Transactions", connectionString, "select * from transactions", True)


Comments

If you have comments, questions or suggestions about any of the Resolver One documentation, please post them to the Documentation Suggestions Forum.

Retrieved from "http://www.resolversystems.com/documentation/index.php/Loading_data_from_a_database_in_user_code"

This page has been accessed 755 times. This page was last modified 15:25, 15 August 2008.

This page: Printable version | View source | Discuss this page | Page history | What links here | Related changes


This Wiki: Special pages | Disclaimers | Privacy policy | Recent changes | Log in / create account

Powered by MediaWiki