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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:01:12+00:00 2026-05-20T12:01:12+00:00

I have been working on asp.net 3.5.I want to Convert a DateTime Data from

  • 0

I have been working on asp.net 3.5.I want to Convert a DateTime Data from sqldatareader to a String on "dd-MM-yyyy" Format.
But when I use "dd-MM-yyyy" formatting parameter as "rdMonthlyLeave["LEAVE_DATE"].ToString("dd-MM-yyyy")" browser returns compile error as

Compiler Error Message: CS1501: No overload for method ‘ToString’ takes ‘1’ arguments

Do you have a solution?

  • 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-20T12:01:12+00:00Added an answer on May 20, 2026 at 12:01 pm

    You need to cast it to DateTime first:

    DateTime leave = (DateTime) rdMonthlyLeave["LEAVE_DATE"];
    DoSomethingWith(leave.ToString("dd-MM-yyyy"));
    

    or just

    ((DateTime)rdMonthlyLeave["LEAVE_DATE"]).ToString("dd-MM-yyyy")
    

    The return type of the DataReader indexer is just object, and object doesn’t have an overload of ToString which takes a string. Don’t forget that overloading is a compile-time decision – the compiler picks the appropriate method with a compatible signature, and only overriding occurs based on the execution-time type. In this case there is no overload of ToString with a compatible signature, so you get a compile-time error.

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

Sidebar

Related Questions

I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been working my way through Scott Guthrie's excellent post on ASP.NET MVC
On a recent project I have been working on in C#/ASP.NET I have some
I am working on a web app using C# and asp.net I have been
I have been working with a string[] array in C# that gets returned from
I have an application that I want to (eventually) convert to ASP.NET MVC. I
For the last 4 years I have been working as an ASP.NET developer in
I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page
I've been working in ASP.NET for several years now (since the 1.0 days!), but
I have been working on a small project on recent delived ASP.NET MVC 3

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.