Solved

linq and formatnumber

Posted on 2009-05-15
4
473 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 62

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 62

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 62

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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now