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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:29+00:00 2026-06-17T12:20:29+00:00

I am working on c# project and using winform. Here the problem is the

  • 0

I am working on c# project and using winform.

Here the problem is the query was working previously but now it is not working

Here the todaydate is a datetimePicker which is set to short date format
and my datatype of column is smalldatetime the error i am getting is

 The conversion of a nvarchar data type to a
     smalldatetime data type resulted in an out-of-range value.
    The statement has been terminated.

if i have two date time picker one for date and second for time then how can i insert? please can you guide me

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

    You’re currently passing in the text value, which means something else is having to then parse it as a date. Don’t do that. Given that you’ve got a DateTimePicker, you should just use the DateTime value it provides:

    cmd.Parameters.AddWithValue("@today", todaydate.Value);
    

    … or create the parameter first with a specific type (SqlDbType.SmallDateTime), then set the value using todaydate.Value. The important point is to avoid the string conversion.

    Wherever possible, you should avoid converting values into text. Keep them in their “natural” form (e.g. DateTime in this case) for as much of the time as possible: on input, parse into the natural form, and if you can avoid ever converting to a string, do so!

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

Sidebar

Related Questions

I am working on project using lxml. here is a sample xml <PatientsTree> <Patient
I'm working on a WinForm project, using BackgroundWorker , for a data extraction procedure,
My team working in a project using Winforms application(c#) & MSSQL 2005 as database.
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
I am working on a project using Groovy, and I would like to take
I'm working on a project using Scala running Selenium tests as part of a
I am working on a project using the Orb feature detector in OpenCV 2.3.1
I'm currently working on a project using netbeans 6.9 and grails 1.3. I'm trying
I am a Java programmer and was working on a project using Hibernate and
As part of trying to learn hadoop, I'm working on a project using a

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.