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

  • Home
  • SEARCH
  • 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 8243275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:27:40+00:00 2026-06-07T21:27:40+00:00

Unsure why I am recieving this error as converting other columns has worked fine.

  • 0

Unsure why I am recieving this error as converting other columns has worked fine.

Basically I have a SELECT statement which plays back int/string/float. The following code only throws the above error on the float, however within the Database/ViewModel they are both of type Float.

VIEWMODEL

public float personalAmount { get; set; }

REPOSITORY

     string selectQuery = "SELECT OC.[id], OC.[number_id], ONU.[mobile_number], OC.[personal_amount], OC.[start_date], OC.[end_date] " +
                                "FROM export OC " +
                                    "INNER JOIN numbers ONU ON OC.number_id = ONU.number_id " +
                                "WHERE OC.[person_id] = " + id;
        SqlCommand myCommand = new SqlCommand(selectQuery);
        myCommand.Connection = myConnection;
        myConnection.Open();

        SqlDataReader dataReader = myCommand.ExecuteReader();
        if (!dataReader.HasRows) return null;

        var newData = new List<List>();
        while (dataReader.Read())
        {
            List list = new List();
            list.id = (int)dataReader["id"];
            list.mobileNumber = dataReader["mobile_number"].ToString();
            list.personalAmount = (float) dataReader["personal_amount"];
            list.startDate = (DateTime)dataReader["start_date"];
            list.endDate = (DateTime)dataReader["end_date"];

            newData.Add(list);
        }
        dataReader.Close();

Thanks in advance for any help 🙂

Clare

  • 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-06-07T21:27:41+00:00Added an answer on June 7, 2026 at 9:27 pm

    Have you tried doing a Float.Parse(dataReader[“personal_amount”].ToString())?

    It’s not a cool way of solving, but it may work.

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

Sidebar

Related Questions

I am unsure on which approach will give me a better performance: I have
Unsure if this is the right place to ask such question. I have to
The following query that I have is encountering a divide by 0 error: select
Unsure how to get this string to work correctly. Keeps making my page blank.
I'm a little unsure of how to ask this question, so I'll start as
I am unsure why this code will not work. When I click a button
I have a piece of javascript executing on a jetty server which is sending
Im unsure about this. Would having PHP ( or I guess any template language
I am receiving this error: File /DateDbLoop.py, line 33 d.Id % (str(day), str(2840)) ^
Okay I have been working on this for about 2 hours and am sure

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.