Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:25:41+00:00 2026-05-31T18:25:41+00:00

Currently am working on a project that requires me to create some XML for

  • 0

Currently am working on a project that requires me to create some XML for use with a graphing plugin. I’m using XML literals and LINQ to SQL as follows

                Dim x As XElement = _
                <chart caption='Aantal aanvragen' xAxisName='Dag' yAxisName='Aantal'>
                    <%= From d In dailies Select _
                        <set label=<%= d.Datum %> value=<%= d.Aantal %>>
                        </set> %>
                </chart>

Dailies is just a more complex Linq query, Datum is of type Date? and Aantal of type Int.

Now my problem is how to format the date properly. I thought that would be something like:

<%= CDate(d.Datum).ToString("d MMM yyyy") %>

Unfortunately that gives me:

System.NotSupportedException: Method ‘System.String ToString(System.String)’ has no supported translation to SQL.

Does anyone have a solution to this? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:25:42+00:00Added an answer on May 31, 2026 at 6:25 pm

    If you want to construct the XML contents you could make sure the data is pulled from SQL server by adding AsEnumerable() e.g.

                Dim x As XElement = _
                <chart caption='Aantal aanvragen' xAxisName='Dag' yAxisName='Aantal'>
                    <%= From d In dailies.AsEnumerable() Select _
                        <set label=<%= d.Datum %> value=<%= d.Aantal %>>
                        </set> %>
                </chart>
    

    that way you can avoid the problem with the attempt to translate your method call ToString() into SQL.

    You will need to decide however, if that table column indeed contains null values respectively if you indeed get d.Datum as Nothing for some items what you want to do in that case, either make sure you exclude those items with e.g.

      From d in dailies.AsEnumerable() Where d.Datum.HasValue Select ...
    

    or use the If operator to output some default. But that’s more a VB problem than an LINQ to XML problem and VB is not my strength so maybe you already have that sorted yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a project for the iPhone that requires accessing a
I'm working on a Firefox extension project that requires me to use the TAB
I'm currently working on a project that requires animation on a transparent panel. I
I am currently working on an android project that requires me to invoke a
I'm working on a project that requires that the vertical borders, which are currently
I'm currently working on a project that requires that I have a div stacked
I'm currently working on a java project that requires me to make a system
I am currently working on a project that is moving from .NET 2.0 to
I am currently working on a project that will store specific financial information about
I'm currently working on a project that hooks into various system calls and writes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.