• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

Variable in SQL query

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
ProgrammingRulesTheWorld
Asked:
ProgrammingRulesTheWorld
  • 3
1 Solution
 
knightEknightCommented:
qlCeCommand comm = new SqlCeCommand("SELECT ItemID, MemberID, Title, Author, CONVERT(NVARCHAR, (Price * " + XMLconfig.commission + "), 0) As Price,  DateSold FROM [CashOutDB]
0
 
knightEknightCommented:
oops, I cut of the leading "s" in SqlCeCommand
0
 
knightEknightCommented:
s qlCeCommand comm = new SqlCeCommand("SELECT ItemID, MemberID, Title, Author, CONVERT(NVARCHAR, (Price * " + XMLconfig.commission + "), 0) As Price,  DateSold FROM [CashOutDB] ");
0
 
ProgrammingRulesTheWorldAuthor Commented:
Sweet thanks man
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now