C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » General »

Executing Commands


Posted Date: 02 Jul 2004    Resource Type: Articles    Category: General
Author: Sajjad HaiderMember Level: Bronze    
Rating: 1 out of 5Points: 5



Introduction

This articles describes the command object which provides methods to execute the SQL statement and stored procedures

ExecuteNonQuery()

This method is used when a result set is not to be returned from the database for example

Dim myCommand AS New OleDbCommand("UPDATE table1 Set Roll = 12 WHERE NAME='Sajjad' ",myConnection)
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

ExecuteReader()

This method Returns a SqlDataReader or OleDbReader object after executing the command

ExecuteScalar()

This method is used to return a single result from the database for example the count of the number of the records in a table like

Dim myCommand AS New OleDbCommand("Select count(*) from table1",,myConnection)
myConnection.Open()
myobject = myConnection.ExecuteNonQuery()
myConnection.Close()

Summary

This article is not my own actually it is taken from book by Hersh Bhasin




Responses

Author: critic    02 Jul 2004Member Level: Bronze   Points : 0
If this article is extracted from other source, kindly give more info about the source so that we will not end up with copyright issues.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Use of NUnit is better way in the TDD
Previous Resource: Document Object Model
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use