?
Solved

Variable in SQL query

Posted on 2011-05-02
4
Medium Priority
?
204 Views
Last Modified: 2012-05-11
VS 2008 Windows forms

I am looking for a way to insert a variable from my "XMLconfig" class into (price * 0.8)
like  (price * XMLconfig.commission)  If someone could show me how to do this that would be great!
SqlCeCommand comm = new SqlCeCommand("SELECT ItemID, MemberID, Title, Author, CONVERT(NVARCHAR, (Price *0.8), 0) As Price,  DateSold FROM [CashOutDB]

Open in new window

0
Comment
  • 3
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 35508210
qlCeCommand comm = new SqlCeCommand("SELECT ItemID, MemberID, Title, Author, CONVERT(NVARCHAR, (Price * " + XMLconfig.commission + "), 0) As Price,  DateSold FROM [CashOutDB]
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 35508216
oops, I cut of the leading "s" in SqlCeCommand
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 2000 total points
ID: 35508225
s qlCeCommand comm = new SqlCeCommand("SELECT ItemID, MemberID, Title, Author, CONVERT(NVARCHAR, (Price * " + XMLconfig.commission + "), 0) As Price,  DateSold FROM [CashOutDB] ");
0
 

Author Comment

by:ProgrammingRulesTheWorld
ID: 35508260
Sweet thanks man
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question