Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

linq and formatnumber

Posted on 2009-05-15
4
Medium Priority
?
487 Views
Last Modified: 2013-11-11
Hi,
How do I get this to work?

.pricew4wd = (From p In q...<price> _
                  Where (p.@vehicle = "yes") _
                  Select (pricew4wd = p.Value.FirstOrDefault(), _      
                  FormatNumber(pricew4wd, 2)), _

I am getting a syntax error.

Thanks
Tania
0
Comment
Question by:Tania_Farmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 24395121
Is this Linq to XML? If so can you post the XML and the full query that you are using so that we can determin where the syntax error is. If it is NOT Linq to XML can you give more details.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 24395868
Something like this should work but without seeing the whole query and code around it, it is hard to tell.

pricew4wd = (From p In q...<price> _
                        Where p.@vehicle = "yes" _
                        Select pricew4wd = p.Value).FirstOrDefault()
                   
Dim numFormatted As Single = FormatNumber(pricew4wd, 2))
0
 

Author Comment

by:Tania_Farmer
ID: 24395956
Hi,
Thanks - sorry missed your reply.

<product code="lr" title="4wd Bush Driving">
      <duration>1 Day</duration>
      <visible>true</visible>
      <prices>
        <price vehicle="yes" >245</price>
        <price vehicle="no">180</price>
      </prices>
</product>

I got this working - is it ok to use structurally?

Select pricewo4wd = Formatnumber(p.Value,2)).FirstOrDefault(), _


T
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 24396059
From what you are showing of the statement that should be fine as well.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 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