0% found this document useful (0 votes)
41 views8 pages

Sql-Server Oracle Oledb Providers Odbc Providers

ADO.NET allows connecting to databases like SQL Server, Oracle, OLE DB, and ODBC. It defines objects like connections, commands, data readers, and data adapters that are used to connect to a data source and execute queries. Data can be retrieved from the database using a data adapter and bound to data-aware controls like a data grid for display. Configuration wizards simplify setting up connections and data adapters to retrieve and display data from a database.

Uploaded by

Fenil Desai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views8 pages

Sql-Server Oracle Oledb Providers Odbc Providers

ADO.NET allows connecting to databases like SQL Server, Oracle, OLE DB, and ODBC. It defines objects like connections, commands, data readers, and data adapters that are used to connect to a data source and execute queries. Data can be retrieved from the database using a data adapter and bound to data-aware controls like a data grid for display. Configuration wizards simplify setting up connections and data adapters to retrieve and display data from a database.

Uploaded by

Fenil Desai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

ADO.

NET

ODBC
SQL-SERVER ORACLE OleDB Providers
providers
System.data.SqlClient System.data.OracleClient System.data.Oledb System.data.ODBC

SQL Connection Oracle Connection OleDB Connection ODBC Connection

SQL Command Oracle Command OleDB Command ODBC Command

SQL Datareader Oracle DataReader OleDB Data Provider ODBC DataProvider

SQL DataAdapter Oracle DataAdapter OleDB DataAdapter ODBC DataAdapter


 Syntax to define the Object
– Dim objectName as new xxxConnection(“ProviderInfo”)
where xx  can be either SQL,Oracle,Oledb or ODBC
 Provider Info
– To connect to MS-Access 2000 above versions 
• Provider=microsoft.jet.oledb.4;datasource=databaseName.mdb
– To connect to SQL-Server db 
• Provider=sqloledb.1;userid=sa;password=;database=database
name;datasource=servername
• Note if SQL Connection is used then provider=providername is
not required.
– To Connect to ORACLE 
• Provider =
oracleoledb.oracle;userid=scott;pwd=tiger;datasource =
servername
• OR
• Provider = msdaora.1;…….
• Note if oracle connection is used then provider= provider name
is not required.
 To define Command Object 
– Dim objectName as new xxxCommand([SQL
Statement,connection object/Connection String])
 To define DataReader 
– Dim objectName as xxxDataReader
 To define DataAdapter 
– Dim objectName as xxxDataAdapter(Select
Statement,<Connection Object / Connection String>)
– When ever the DataAdapter is defined using the above
syntax then only the command relevant for the
SelectCommand will be defined and in order to use the
above commands they have to be build explicitly.
 To define DataSet 
– Dim objectName as new DataSet()
 To define DataView 
– Dim objectName as new
DataView(datasetName.DataMemberName)
Steps to project the data from oracle
database and to project it on the form(1)
 Step 1] Place the oracleDataAdapter control
present in the Data Tab of toolbox on to the
form.
 Note  the above step will invoke an wizard to
configure the DataAdapter.
 [Steps to do for the First Time]
 Click on the new Connection
 Specify the user name,password & server
name and check “allow saving password”
checkbox.
 Click on the Test Connection button to verify if
the connection has been established properly.
 Click on the OK Button define the connection
object
Steps to project the data from oracle
database and to project it on the form(2)
 Step 2] Specify the select statement and click
on the Next Button.
– Note: if the base object table is defined with
primary key then the above step will define all the
commands of the dataAdapter else the commands
relevant for the update command and the delete
command will not be defined.
 Step 3] Click on the finish button to complete
the configuration of dataAdapter.
– Note  The above step will define the connection
object and the DataAdapter Object.
Steps to project the data from oracle
database and to project it on the form(3)
 Step 4].Right click on the DataAdapter and
click on Generate DataSet.
– Note  The above step will define the DataSet Object
 Step 5].Place the data Grid Control present in
the webform tab of toolbox on to the form.
 Step 6].Set the following properties for the
Data Grid Control:
– DataSourceSpecify the name of the dataset
– DataMember Specify the name of the
dataMember of the dataset to be binded for
datagrid control.
Steps to project the data from oracle
database and to project it on the form(4)
 Step 7].[OPTIONAL STEP] right click on the
datagrid control and click on the AutoFormat
to provide a better look and feel for the
datagrid control.
 Step 8].Write the code as per the requirement.

– In the page Load


• OracleDataAdapter.fill(dataset11,”emp”)
• Datagrid1.databind()
By writing code
 Imports system.Data.Oledb
 In the page_load
– Dim objconn as new
oledbconnection(“provider=oracledb.oracle;userid=sc
ott;password=“tiger”;datasource=servername”)
– Dim objDA as new oledbDataAdapter(“Select * from
emp”,objconn)
– Dim ds as new dataSet
– objdA.Fill(ds,”emp”)
– Datagrid1.datasource = ds.Tables(0)
– Datagrid1.databind()

You might also like