• Like
ADO.NETObjects
Upcoming SlideShare
Loading in...5
×
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,092
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
121
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. ADO.NET Objects
    SqlCommand
    SqlConnection
    SqlDataReader
    SqlDataAdapter
    DataTable
    DataSet
    DataView
  • 2. ADO.NET Objects
    • Connection helps you identify
    Database Server
    Database Name
    Password
    UserName
    SqlConnection
    Database
  • 3. ADO.NET Objects
    SqlConnection con= new SqlConnection (“Data Source=(local);Initial
    Catalog=Master; Integrated Security=SSPI”);
    SqlConnection con= new SqlConnection (“Server=<Servername>;Data
    Source=(local);uid=<SqlServerUserId>;Pwd=<SqlServer Password>”);
  • 4. ADO.NET Objects
    • Various methods available in SqlConnection Object
    • 5. Open()
    • 6. Opens the connection to our database
    • 7. Close()
    • 8. Closes the database connection
    • 9. Dispose()
    • 10. Releases the resources on the connection object
  • ADO.NET Objects
    • SqlCommand
    • 11. Used to execute commands to a database across a data
    connection
    • Send SQL statements to the database to perform certain action
    • 12. What type of interaction you want to perform with a database
    Select
    Insert
    Delete
    Update
    SqlConnectioncon=new SqlConnection(“Data Source=(local);Initial
    Catalog=Master; Integrated Security=SSPI”);
    Con.Open();
    SqlCommandcmd=newSqlCommand(“select * from student”,con);
    Con.Close();
  • 13. ADO.NET Objects
    • Various Methods Available in SqlCommand Object
    • 14. ExecuteNonQuery()
    • 15. Expects to run a command or a stored procedure
    • 16. ExecuteScalar()
    • 17. Returns only one value after executing the query
    • 18. ExecuteReader()
    • 19. Expects to run a query command or a stored procedure
    that SELECTS records
  • 20. ADO.NET Objects
    • SqlDataReader
    • 21. Provides a forward-only, read-only, connected stream record set
    from a database
    • Returned as the result of the Commandobject's ExecuteReader()
    SqlCommandcmd=new SqlCommand(“select * from student” , con);
     
    SqlDataReaderre=cmd . ExecuteReader();
  • 22. ADO.NET Objects
    • Basic Methods available in SqlDataReader Object
    • 23. Read()
    • 24. Used to move the Record Pointer to the first row which
    allows the data to be read by the column name or the index
    position
    • HasRow()
    • 25. Checks if any data exists, and it is used instead of the Read()
    • 26. Close()
    • 27. Used to close the SqlDataReader()