Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Oracle Database wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Concurrency control wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational model wikipedia , lookup
ContactPoint wikipedia , lookup
Clusterpoint wikipedia , lookup
Architecture of ADO.NET Introduction • ADO.NET is a collection of classes, objects, methods and properties that manage data access from relational databases with in the .NET platform. • These collections are organized in the namespaces System.Data, System.Data.Oledb, System.Data.Sqlclient. Architecture Components of ADO.NET ADO.NET provides two central components. .NET Data Provider DataSet .NET Data Provider • Data provider acts as a bridge between an application and database. • It is used to retrieve data from a database and send back to the database after changes. Components of .NET Provider .NET Data Provider consist of four object components. Connection object Command object DataReader object DataAdapter Components of .NET Provider Connection object • These objects are used to create a connection to the database for moving data between the database and user application. • This connection can be created using oleDbConnection or SqlConnection object. • Open(), close() and dispose() are the methods of connection object used to open and close the defined connection. Example • DIM con As SqlConnection • Con=New SqlConnection() • Con.ConnectionString=“data source = asdf; initial catalog = stud; user id = sa; pwd =“ • con.open() Explanation • data source - name of the SQL server which is to be connected. • initial catalog - name of the database • user id – SQL login account • pwd – is the password • The user must close the connection after using it. This is done by either close or dispose method. con.close() Command objects • These objects are used to read, add, update and delete records in a database. • These operations are done by the objects OledbCommand or SqlCommand and the method ExecuteReader() or ExecuteNonQuery(). Methods in Command object ExecuteReader() • It is used to execute the commands and retrieve rows from the database. ExecuteNonQuery() • It is used to execute the commands without retrieving any row. Example • DIM con As SqlConnection • DIM cmd As SqlCommand • cmd.Connection = con • Cmd.CommandText=“select * from studTable” DataReader object • These objects are used to read row wise data in read only format from databases. • The SqlDataReader or OleDbReader object is used depending on the database. • The ExecuteReader() method is used to retrieve a row from database. Methods in DataReader Read • It is used to obtain a row from the result of the query. GetString • It is used to access a column value in a selected row. Close • This method must be called after the use of DataReader object. Example • DIM cmd As SqlCommand • DIM myReader As SqlDataReader • myReader = cmd.ExecuteReader() • Do While myReader.Read() • MsgBox (myReader.GetString(0) & Vbcr & myReader.GetString(1)) • Loop • myReader.Close() DataAdapter object • This object is used to exchange data between a database and a dataset. • It reads data from the database to the dataset and then write the changed data back to the database. • The Fill() method is used to write the result of SelectCommand into the dataset. Properties of DataAdapter • SelectCommand for accessing rows in a database • InsertCommand for inserting rows in to the database • UpdateCommand for modifying rows in the database • DeleteCommand for deleting rows Example • DIM Myadapter As New SqlDataAdapter • Myadapter.SelectCommand=mycomm • DIM Mydataset As New DataSet() • Myadapter.Fill(MydataSet,studTable) • con.close() DataSet • DataSet is a virtual storage of records retrieved from the database. • It contains collection of Tables, Primary key and other related information. DataSet The End …… Thank You …..