getting error : : The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

update tblPact_2008_0307 set student_dob = '30/01/1996' where student_rcnumber = 1830

when entering update date in format such as ddmmyyyy

i know the sql query date format entered should be in mmddyyyy format

is there any way to change the date format entered to ddmmyyyy in sql query?

0
numbskull77
1/28/2008 9:44:23 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

5 Replies
1014 Views

Similar Articles

[PageSpeed] 44

Before the update execute: SET DATEFORMAT dmy


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
florinlabou
1/28/2008 10:02:39 AM

everytime i do a query on date format ddmmyyyy, i need to do a set dateformat dmy?

is there anyway to configure the sql server to set the dateformat in dmy as default? 

0
numbskull77
1/28/2008 10:13:53 AM

Use this query 

 .. set student_dob = convert(datetime,convert(datetime,'31/01/2007',103),101) where ....

 

 

0
satheesh
1/28/2008 10:21:44 AM

When you use DATEFORMAT option you have to set it before using a datetime reference with the format dmy. It is not a database or server option so it cannot be set once for all your queries.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
florinlabou
1/28/2008 10:48:27 AM

<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-IE"/>

use the above globalization encoding to change the culture to en-IE (irish dd,mm,yyyy) or which ever in the web.config. this doesnt mean it will store the values in the DB as dd,mm,yyyy but when your input in the format dd,mm,yyyy it wont throw an error, but it may return dates in the mmddyyyy format.

0
kp8080028
1/28/2008 1:25:56 PM
Reply:

Similar Artilces:

Error : The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
 My website is facing one problem after hosting to the server.When i execute my code from local(india) all working fine.But when i host it to UK,the error coming "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value" . I used Culture=en-GB in web.config.But not solved.This error is coming to all pages where datetime value is using..Please help me ..  Can you post your code or screenshot showing the error on some code line...  Thanks,santosh_maharajaPlease mark as answer if you got expected solution.  this is ...

Error:"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."
I still don't know what is happening with my application. I used before in another page the formview control and I didn't have the out of range Date error. It was normally. But now, I'm doing everything manually and I don't know why, but I'm with this problem. I need to safe this problem today... Here go my code! The error occurs here: (It's the Sub that Insert data inside of the database(SQLServer)Protected Sub Gravar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim SQL As String = "Update RECEBER SET  EMISSAO = '" & CType(tbDataEmissao.Text, Date) & "', VENCIME...

System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
After clicking my update button I'm receiving this error:    The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been...

System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
After testing out the application i write on the local pc. I deploy it to the webserver to test it out. I get this error. System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. Notes: all pages that have this error either has a repeater or datagrid which load data when page loading. At first I thought the problem is with the date, but then I can see that some other pages that has datagrid ( that has a date field) work just fine. anyone having this problem before?? hopefully you guys can help...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
 Hello,When i run my project in VS IDE i dont get this below mentioned error but assoon as i put it in IIS of my server machine i get this error.I am using this application since months and wasn't getting any error. But recently when my admin made some changes in server..This error started coming. I have no help from my admin regarding this.  Let me know if i have to do some changes in c# code or in database or in windows server machine or in IIS or in crystal report properties !! The error is as follows : Normal 0 false false false ...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Hey, I have a big problem that i wanna search data from SQL by DateTime like thatselect * from test where recorddate='MyVariableWhichHoldDate'i use variable that holds Date info.i searched a lot infomation on net but there is no perfect solution. i know why this occur but there is no function to solve this problem. i used a lot of ways. it accept yyyy-mm-dd format but my variable format is dd-mm-yyyyy . is there any function for this problem? and any other solution.thanks for ur attentionregards Just do select * from table where dateField = '1-1-2005'. This will work..Nick The safest for...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
 Please help me its give me the error on server but run successfully on my local  The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Hello this is my code: ( I want to see if the date is in a month of a selected year)Dim command As New SqlCommand command.Connection = connection command.CommandType = CommandType.Text command.CommandText = "SELECT count(*) fROM tblRequests r WHERE r.StateID =4 AND r.CategoryID <>2 AND r.CompletionDate BETWEEN '" & year & "-" & teller & "-01' AND '" & year& "-" & teller + 1 & "-01'"Dim objaantal As Object = command.ExecuteScalar() Dim Incidents As Integer If Not objaantal Is No...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
I still don't know what is happening with my application. I used before in another page the formview control and I didn't have the out of range Date error. It was normally. But now, I'm doing everything manually and I don't know why, but I'm with this problem. I need to safe this problem today... Here go my code!Thanks Raphael <%@ Page Language="VB" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SQLClient" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server"> ...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
  Hi , i m inserting the values in the fallowing ways INSERT INTO LoginHistory([UserID],[LoginTime],[LoginIP])VALUES('NilCom1Ad01','13-04-2009 4:52:54 PM','127.0.0.1' ) Still i  m Geting errror  The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated.Plz  help me  I'm wondering if your database is expecting month/day/year, in which case 13 would be causing your problem.  Change the date to 04-13-2009 and give it a try.C# <---> V...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Normal 0 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-b...

conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
  When I run this error I get this error  ' The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.' select distinct pro.prodname, pro.price, pro.description, pro.fromdate, pro.todate, pro.pic1 from products pro inner join booking on pro.category=booking.category where pro.category=1 and '12/11/2008' between pro.fromdate and pro.todate and '18/12/2008' between pro.fromdate and pro.todate and '12/11/2008' not between booking.checkin and booking.checkout and '18/12/2008' not between booking.chec...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. #3
 I use the ajax calendar to select date. When I add the selecting date, I convert it to string. in my database the field is varchar to add this date. However when I add some date I take this warning The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. I can not understan this situation :S Hi! Can you please tell  at what point of time you are getting this error? whether at the time of converting the selected date into string  or while saving in the DB. As you mentioned, the database field is varchar , then there is no cha...

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. #2
sombedoy can solve this problem:   my code:   '######################################## '# Create values for XML File # '########################################Dim command As New SqlCommand command.Connection = connection command.CommandType = CommandType.Text  Dim datum1, datum2 As DateTime   datum1 = teller6.ToString & "/01/" & jaar & " 0:00:00" datum2 = (teller6 + 1).ToString & "/01/" & jaar & " 0:00:00"   command.CommandText = "SELECT count(*) fROM tblRequests r WHER...

Web resources about - getting error : : The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value - asp.net.sql-datasource

Social media: when death doesn't mean out of range
Imagine this: Sarah, having completed high school, heads off to Europe for a holiday. Fulfilling a long-held ambition, she visits the Eiffel ...

‘Keycard’ Locks Your Mac When Your iPhone Goes Out of Range
If you’ve ever wanted a quick way to ensure that others can’t use your Mac when you step away from it and you’re the type of person to keep your ...

What you can do with Apple Watch when your paired iPhone is out of range
Lory Gil, writing for MacRumors, lays out two lists: One with your Apple Watch in the wild with no iPhone and no WiFi, and one with no iPhone ...

What You Can Do With Apple Watch When Your Paired iPhone is Out of Range
... range, and it is not connected to the same Wi-Fi network, there are a number of features that are still available: You can play music from ...

Tesla Says It Will Now Be “Impossible To Run Out Of Range Unintentionally” In A Model S
A few days ago, Elon Musk pledged to "end range anxiety" for Model S owners by way of an over-the-air software update. Today, he's detailed how ...

Out of range
... say: “It has everything from a roller coaster for the kiddies to high-end boutiques for fashionistas.” The “from” and “to” implies a “range,” ...

Resources last updated: 12/22/2015 3:31:26 PM