Home   Help Login Register  
Welcome, Guest. Please login or register.

Login with username, password and session length

Search
Free Website WooThemes - Quality Themes, Great Support
Pages: [1]   Go Down
Print
Topic: need answer  (Read 1368 times)
« on: June 15, 2009, 12:48:37 AM »
johndavid Offline
Newbie

View Profile
*

iTrader: 0
Posts: 1



hi friend i am having one doubt in dotnet so if anyone can able to help pls

this is my doubt
What is the purpose of Execute scalar method of Command object ?

Share this topic on AskShare this topic on BlinkbitsShare this topic on BlinklistShare this topic on BloglinesShare this topic on BmarksShare this topic on Del.icio.usShare this topic on DiggShare this topic on DzoneShare this topic on FacebookShare this topic on Feed Me LinksShare this topic on FurlShare this topic on GoogleShare this topic on LiveShare this topic on MagnoliaShare this topic on MySpaceShare this topic on NetvouzShare this topic on NewsvineShare this topic on OneviewShare this topic on RedditShare this topic on RojoShare this topic on ScuttleShare this topic on ShadowsShare this topic on SlashdotShare this topic on SpurlShare this topic on SquidooShare this topic on StumbleUponShare this topic on TechnoratiShare this topic on TwitterShare this topic on TipdShare this topic on YahooShare this topic on Google buzz
Logged
« Reply #1 on: June 24, 2009, 10:55:05 PM »
subhaikav Offline
Newbie

View Profile WWW
*

iTrader: 0
Posts: 5



I too have the same doubt....... Anyone help us?
Logged
« Reply #2 on: June 24, 2009, 11:03:48 PM »
Kailash Offline
Administrator
Newbie

View Profile WWW
*****

iTrader: 50
Posts: 286



Hi,

Welcome to the forum!

I am not good in .Net but I found one useful msdn link for ExecuteScalar Method:

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx

Hope this will help you.

Kailash
Logged

« Reply #3 on: March 29, 2010, 05:28:23 AM »
mikesleves Offline
Newbie

View Profile
*

iTrader: 0
Posts: 3



When a query return single value from database, The ExecuteScalar Method is used. In such cases Sql Statements like Finding no of records, finding Maximum value from table. And then performing the operations necessary to generate the single value. Other Columns Value or rows are ignored.

This would be easy for receiving a records in an sql statement, or for any query where only one specific field in one column is needed.
cmd.CommandText = "select count(*) from projects";
Int32 count1 = (int32) cmd.ExecuteScalar();
Logged
« Reply #4 on: April 09, 2010, 12:02:48 AM »
StevenJr Offline
Newbie

View Profile
*

iTrader: 0
Posts: 16



Quote
hi friend i am having one doubt in dotnet so if anyone can able to help pls
this is my doubt
What is the purpose of Execute scalar method of Command object ?




Hi John,

The “ExecuteScalar” method is used to retrieve a single value from the database. This requires less code than using the “ExecuteReader” method which is used to generate a single value through data returned by SqlDataReader. The method is fast and utilizes less resources from the database.
Logged

Setup your own home business  to earn a lot
Pages: [1]   Go Up
Print
Jump to:  

Untitled Document
(c) 2012 HELM, WHM, cPanel, ASP, .Net development, PHP, MySQL, MSSQL Server, SEO support forum
Powered by SMF 1.1.16 | SMF © 2011, Simple Machines | Forum style designed by PixelSlot
Google - Sitemap - XML Sitemap