?
Solved

linq and formatnumber

Posted on 2009-05-15
4
Medium Priority
?
482 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 63

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 63

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 63

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

741 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