Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2009, 04:53 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default How to reteive values from the table and store them in a variable

Hi
i need to perform a calculation in my code and i need the values to be retrived from Table1, so far i took this approach:
[code]
Dim con AsNew SqlConnection(ConfigurationManager.ConnectionStrin gs("test").ConnectionString)
Dim cmdd AsNew SqlCommand("select NumberEmailSent from Users Where Name= @Name")
cmdd.Parameters.Add("@Name", Data.SqlDbType.NVarChar, 50).Value = Me.Label4.Text
cmdd.Connection = con
con.Open()
cmdd.ExecuteNonQuery()

con.Close()
???????????

[code/]

This code get ste value but i don know how to store it in a variable so i can perform the calculation.

the calculation gonna be (NumberEmailSend * Payrate1)
thanks
__________________
bx
 
Old February 27th, 2009, 04:57 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SilverLight FAQ

Can anybody provide me list of questions and answers of Silver Light 2.0 for interview.

Thanks in Advance,
Prashant
 
Old February 27th, 2009, 06:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

ExecuteNonQuery executes a query on the server but returns no results. It's used for statements like DELETE and INSERT that don't return data.

You'll need to use ExecuteScalar (for a single value) or ExecuteReader (for a result set) instead. Check out the ADO.NET quick starts for more info: http://www.dotnetjunkies.com/quickst...ldtreader.aspx

Cheers.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
store & reteive email attachment in database gaurikhot .NET Framework 2.0 0 December 17th, 2008 05:21 AM
How to store ntext or text value to local variable ramk_1978 SQL Server 2000 3 September 14th, 2005 07:59 PM
How to Store Literal Value in Variable/Parameter kwilliams XSLT 5 August 31st, 2005 08:52 AM
How to store single value in variable? sacred21 Classic ASP Basics 1 December 29th, 2004 05:25 AM
Store a value to a variable until user quits Acces Sharq Access VBA 7 January 7th, 2004 10:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.