Print Page | Close Window

how do i collect sql data field as variable?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=25656
Printed Date: 28 March 2026 at 7:09pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: how do i collect sql data field as variable?
Posted By: Dan H
Subject: how do i collect sql data field as variable?
Date Posted: 27 April 2008 at 1:18am
Visual web dev 2005 and sql server 2005 express- new to asp.net (some asp experience)

SelectCommand="SELECT Base AS Expr1, CountBase AS Expr2, BlockCost AS Expr3, CountBlock AS Expr4, Record AS Expr5 FROM Billing ORDER BY Expr5 DESC">

I assume the 'Expr1', etc are going to be my variables? Adding <%=Expr1%> to text causes 'not declared' error.
Inserting Dim Expr1 generates a page of various error messages.
 
I need some beginners' help here!
Thanks.



Replies:
Posted By: Dan H
Date Posted: 27 April 2008 at 6:13pm
Ok- I'm part way there...
'FormView' gives me a way to mix the selected datafields with text. Very cool, but I still haven't figured out how to get the data to fit into variables so I can formatstring or otherwise manipulate them.
Help?


Posted By: __n3o__
Date Posted: 27 May 2008 at 10:55am
Hi Dan..

Why are you selecting everything as something?  Why don't you just do a normal select statement? Confused

SelectCommand="SELECT Base, CountBase, BlockCost, CountBlock, Record FROM Billing ORDER BY Record DESC"

If you paste your code and let me know what your trying to do I'll see if I can help



Posted By: jamie.townsend
Date Posted: 27 May 2008 at 12:28pm
I find working with a repeater is easist if you are going to be formatting the variables.

http://www.w3schools.com/ASPNET/aspnet_repeater.asp



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net