Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is execute scalar?

Answer Posted / yograj pandey

Use the ExecuteScalar method to retrieve a single value (for example, an aggregate value) from a database. This requires less code than using the ExecuteReader method, and then performing the operations that you need to generate the single value using the data returned by a SqlDataReader.

A typical ExecuteScalar query can be formatted as in the following C# example:

cmd.CommandText = "SELECT COUNT(*) FROM dbo.region";
Int32 count = (Int32) cmd.ExecuteScalar();

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is entity framework different from ado.net?

1004


Is datareader faster than datatable?

1017


oledbdataadpter with ms access in c#.net giving exception System.Data.OleDb.OleDbException while writing adapter.update(dataset,"tabname"); how to update the database from dataset?

2449


What is ado.net tutorial?

1001


What is namespace in ado.net?

1080


What is difference in record set and dataset?

1155


What is ado oledb and odbc?

986


Explain how to call the sql commands asynchronously in ado.net version 2.0?

979


Is ado.net dead?

1060


What is openrowset?

1037


Can datareader hold data from multiple tables?

1227


How to bind the controls(best practice) comboboxes to the data in the dataset?

1095


What does ado stand for in ado.net?

1196


What are the pre-requisites for connection pooling?

1059


What are the advantage of ado.net?

1042