Click here to Skip to main content
15,888,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually am try to change my table column datatype but it's thrown a error
like this
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
pls help me
Posted
Comments
[no name] 18-Oct-14 18:47pm    
Okay.... help you with what? Find the value that is not a valid DateTime and fix it.

1 solution

So don't do that.

Most likely, it's either a problem with user input being completely invalid, or in the wrong format for SQL. And the normal reason for that is that your presentation code isn't validating user input either at all or correctly, and is passing it through by concatenating strings to form an SQL command. This is dangerous, as it leaves you wide open to SQL Injection Attacks which could damage or destroy your database.

So convert the date to a DateTime value in your C# or VB code, and pass that as part of a parametrised query. That should fix both problems.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900