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 674639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:43:45+00:00 2026-05-14T00:43:45+00:00

9 months later, the same problem shows up again. I’ve tried everything I can

  • 0

9 months later, the same problem shows up again. I’ve tried everything I can think of:

  • I cast as varchar(max) on the stored procedure;
  • I changed the mapping;
  • tried to find the collection linq works with, but couldn’t find anywhere;

I have been running this stored procedure for some time Mapping it to my objects using LINQ to SQL, and now, all of the sudden, LINQ is trying to cast the field ‘value’ as double.


the error:

specified cast is not valid    
   System.Data.SqlClient.SqlBuffer.get_Double()
   System.Data.SqlClient.SqlDataReader.GetDouble(Int32 i)
   Read_Field(ObjectMaterializer`1 )
   System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReader`2.MoveNext()
   System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   CmsCsharp.BL.FieldManager.FindContentField(Int32 id_content, Int32 id_fieldType, String fieldName) 

the methods

public static Field FindContentField(int id_content, int id_fieldType, string fieldName)
            {
                using (DbBase conn = new DbBase())
                {
                    try
                    {
                        return conn.ClientDB.sprocFindContentField(id_content, id_fieldType, fieldName).Single();
                    }
                    catch (Exception e)
                    {
                        return null;
                    }
                }
            }



[Function(Name = "dbo.sprocFindContentField")]
        public ISingleResult<Field> sprocFindContentField([Parameter(DbType="Int")] System.Nullable<int> id_content, [Parameter(DbType="Int")]System.Nullable<int> id_fieldType, [Parameter(DbType="Varchar(255)")]string fieldName)
        {
            IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id_content, id_fieldType, fieldName);
            return ((ISingleResult<Field>)(result.ReturnValue));
        }

the field:

public class TextField : Field
{
   private string _Value;

    [Column(Storage="_Value", DbType="VarChar(MAX) NOT NULL", Name="value", CanBeNull=true)]
    public string Value
    { //get and set }
}

the procedure:

  SELECT 
         type = 'textField',
         fieldLabel.id_fieldEditor,
         fieldLabel.id_fieldType ,
         fieldLabel.description,
         fieldLabel.id ,         
         sessionField.id  AS relationId,
         fieldLabel.name ,
         fieldText.content AS value,
         fieldText.id  AS valueId,
         cf.id as contentRelationId
  FROM
         fieldLabel
  INNER JOIN
         sessionField
  ON
         sessionField.id_fieldLabel = fieldLabel.id
  INNER JOIN
        cms_contentField AS cf
  ON
        cf.id_sessionField = sessionField.id
  INNER JOIN
         fieldText
  ON
         fieldText.id = cf.id_fieldValue
  INNER JOIN
        fieldType
  ON
        fieldLabel.id_fieldType = fieldType.id
  INNER JOIN
        fieldTable
  ON
        fieldTable.id = fieldType.id_fieldTable
  WHERE
         cf.id_content = @id_content
  AND
        fieldTable.id = 1
  • 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-14T00:43:46+00:00Added an answer on May 14, 2026 at 12:43 am

    I’ve changed the 9th line in the stored procedure to fieldText.content,

    SELECT 
         type = 'textField',
         fieldLabel.id_fieldEditor,
         fieldLabel.id_fieldType ,
         fieldLabel.description,
         fieldLabel.id ,         
         sessionField.id  AS relationId,
         fieldLabel.name ,
         fieldText.content AS value, //this line
         fieldText.id  AS valueId,
         cf.id as contentRelationId
    

    then I changed the mapping accordingly:

    [Column(Storage="_Value", DbType="VarChar(MAX) NOT NULL", Name="content", CanBeNull=true)]
    public string Value
    { //get and set }
    

    and it worked!

    Have no idea why it worked. Does the labeling (as value) could be the cause?

    Thank you

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

Sidebar

Related Questions

The two tables below can both hold the same data - a full year,
Hi i'm struggling with adding time dimension to OLAP cube. I can get everything
I installed joomla! 1.5 in a subfolder of my website root. Months later I
For months now I've been trying to find a code syntax formatting extension that
Few months ago, I have came across a Silverlight tutorial of Eric Cartman (South
2 months ago I was writing a web-application which use some classes to draw
Several months (maybe even a year or two) ago, I saw an asp .net
Several months ago I learned from an answer on Stack Overflow how to perform
Six months ago I wrote a OpenID library. It is trying to authenticate with
Some months ago, a colleague of mine installed ODAC 11.106.21 in a server using

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.