Your SlideShare is downloading. ×
0
ADO.NET Objects<br />SqlCommand<br />SqlConnection<br />SqlDataReader<br />SqlDataAdapter<br />DataTable<br />DataSet<br /...
ADO.NET Objects<br /><ul><li>   Connection helps you identify</li></ul>Database Server<br />Database Name<br /> Password<b...
ADO.NET Objects<br />   SqlConnection con= new SqlConnection (“Data Source=(local);Initial <br />                         ...
ADO.NET Objects<br /><ul><li>  Various methods available in SqlConnection Object
Open()
 Opens the connection to our database
Close()
 Closes the database connection
Upcoming SlideShare
Loading in...5
×

ADO.NETObjects

1,183

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,183
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
131
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "ADO.NETObjects"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×