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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:39:51+00:00 2026-05-26T18:39:51+00:00

In a TextBox, user enters date in the format dd/MM/yyyy format. I am sending

  • 0

In a TextBox, user enters date in the format dd/MM/yyyy format. I am sending this value to stored procedure as:

cmd.Parameters.AddWithValue("@myDate", Convert.ToDateTime(txtMyDate.Text));

The stored procedure parameter is of the type SmallDateTime. I want to pass the above code value in dd/MM/yyyy format. How to specify the format in the above code to make sure that SQL Server stores dates in dd/MM/yyyy format?

  • 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-26T18:39:51+00:00Added an answer on May 26, 2026 at 6:39 pm

    What you describe is a bit confusing:

    IF the parameter of the Stored Procedure is indeed SmallDataTime then it inherently has no format. txtMyDate.Text seems to be a string and thus have a dateformat… you can either be localizetion-friendly and keep your code as it is – at least in a normal desktop app it would take into account the system setting for dateformat. Another option is to explicitely hardcode the format so that the user input has to be in this specific format… this can be done by using DateTime.ParseExact ( txtMyDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture ).

    MSDN references:

    • http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx
    • http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
    • http://msdn.microsoft.com/en-us/library/ms182418.aspx
    • http://msdn.microsoft.com/en-us/library/ms180878.aspx
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this textbox: <%= Html.TextBox(EffectiveDate, Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString(dd-MMM-yyyy) : , new { @class
In a textbox user can enter date. In OnChange event I am trying to
When a user enters a date in text box,i've to check ,whether it is
I have a textbox where the user enters a number, but how can i
Say, I have a TextBox - When the User enters contents into TextBox and
On a previous page I have a textbox. Now the user enters in a
Displaying Type here to ... until the user enters text into a TextBox is
I want to validate the value a user enters in a text box, so
I have a textbox.T he user will be entering entering a number in this
Is there a way in Jquery to make the date as standard format (mm/dd/yyyy)

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.