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) & "', VENCIMENTO = '" & CType(tbVencimento.Text, Date) & "', PREVREC = '" & CType(tbPrevRecebto.Text, Date) & "'

Dim Conexão As SqlConnection = New SqlConnection("Data Source=SERV-IPE2;Initial Catalog=IpeSys;Persist Security Info=True;User ID=ASPNET;Password=IpeSys")                  Dim ComandoSql As New SqlCommand(SQL, nexão)           Conexão.Open   ComandoSql.ExecuteNonQuery()      Conexão.Close()  
      

End Sub


This is the following 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 terminated.

Source Error:

Line 190:            Dim ComandoSql As New SqlCommand(SQL, Conexão)
Line 191:            Conexão.Open()
Line 192:            ComandoSql.ExecuteNonQuery()
Line 193:            Conexão.Close()
Line 194:            Response.Redirect("Lista.aspx")

Source File: D:\IPESys_SYSTEM\Administrativo\FINANCEIRO\MOVIMENTACAO\ContasReceber\Form.aspx    Line: 192


THANKS A LOT!

RAPHAEL

0
Raphael
7/14/2005 8:08:20 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
853 Views

Similar Articles

[PageSpeed] 9

What is the SQL command you are executing? Set a breakpoint at line 190 and then run SQL directly from SQL Query Analyzer. You will be able to determine what datevalue you are trying to use that is out of range. I assume one of your Date conversions is producing a value that is invalid.

0
ZLA
7/15/2005 2:10:21 AM
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 ...

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 = 1830when entering update date in format such as ddmmyyyyi know the sql query date format entered should be in mmddyyyy formatis there any way to change the date format entered to ddmmyyyy in sql query? Before the update execute: SET DATEFORMAT dmyPlease remember to mark the replies as answers if they help and unmark them if they provide no help. 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...

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...

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...

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.
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.
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...

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.
 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.
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.
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. #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 - Error:"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value." - asp.net.presentation-controls

Resources last updated: 12/3/2015 11:33:39 AM