Solved

linq and formatnumber

Posted on 2009-05-15
4
476 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
  • 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 500 total points
ID: 24396059
From what you are showing of the statement that should be fine as well.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

792 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