Create a DataSourceProvider that uses Ado to access a SQL database. This constructor calls DbProviderFactories.GetFactory(providerName) to get a provider and uses that provider and the connection string to create a connection. Each forEach and query tag will also cause a connection to be created. Example: Access: "System.Data.Odbc", "Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=Northwind.mdb" DB2: "IBM.Data.DB2", "server=db2.windwardreports.com;database=SAMPLE;Uid=demo;Pwd=demo;" Excel: "System.Data.OleDb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Northwind Mini - Data.xlsx;Extended Properties=\"Excel 12.0 Xml;HDR=YES\"" MySql: "MySql.Data.MySqlClient", "server=mysql.windwardreports.com;database=sakila;user id=demo;password=demo;" ODBC: "System.Data.Odbc", "Driver={Sql Server};Server=localhost;Database=Northwind;User ID=test;Password=pass;" OleDB: "System.Data.OleDb", "Provider=sqloledb;Data Source=localhost;Initial Catalog=Northwind;User ID=test;Password=pass;" Oracle: "Oracle.DataAccess.Client", "Data Source=oracle.windwardreports.com:1521/HR;Persist Security Info=True;Password=HR;User ID=HR" Do not use System.Data.OracleClient - even Microsoft discourages its use. SqlServer: "System.Data.SqlClient", "Data Source=mssql.windwardreports.com;Initial Catalog=Northwind;user=demo;password=demo;"
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim providerName As String
Dim connectionString As String
Dim instance As New AdoDataSource(providerName, connectionString) |
Parameters
- providerName
- The name of the provider. For example, for SqlServer this would be "System.Data.SqlClient".
- connectionString
- The connection string used in the IDbConnection constructor.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP, Windows Vista, Windows Server 2003 family
See Also