problem with date
-
hi, I am working in asp.net 2.0 with vb script. I have few projects which were working fine. But suddent from last few days all are giving the error that is related to date function. Date is not getting stored in database. It gives the error that string cant be converted to date. But it was working fine. and also when i select data from database to bind in a datatagrid then also it is giving the same error. What might be the reason? The datatype in database is DateTime. The syntax i am using is text1.text=calendar1.selecteddate insert table1(ddate) values ('" & text1.text.trim & "')
Chaitra N
-
hi, I am working in asp.net 2.0 with vb script. I have few projects which were working fine. But suddent from last few days all are giving the error that is related to date function. Date is not getting stored in database. It gives the error that string cant be converted to date. But it was working fine. and also when i select data from database to bind in a datatagrid then also it is giving the same error. What might be the reason? The datatype in database is DateTime. The syntax i am using is text1.text=calendar1.selecteddate insert table1(ddate) values ('" & text1.text.trim & "')
Chaitra N
You never use vbscript with ASP.NET. Well, if you are, you're using it on the client, and you shouldn't, because it ties you to IE. What is the string that it can't convert ? Have you checked in the debugger ? Have your locale settings changed ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You never use vbscript with ASP.NET. Well, if you are, you're using it on the client, and you shouldn't, because it ties you to IE. What is the string that it can't convert ? Have you checked in the debugger ? Have your locale settings changed ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
The project had been developed with VBScript. it says string "" cannot be converted to type date and in some areas char cannot be converted to type date I have not changed anything with my local system
Chaitra N
-
The project had been developed with VBScript. it says string "" cannot be converted to type date and in some areas char cannot be converted to type date I have not changed anything with my local system
Chaitra N
So, it is ASP.NET, but uses VBSCript on the client side ? you know you can change to javascript on a page by page basis, right ? VBScript will only run in IE. If you have an empty string, it plainly cannot be converted to a date, you need to fix your code so the string is not empty.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
hi, I am working in asp.net 2.0 with vb script. I have few projects which were working fine. But suddent from last few days all are giving the error that is related to date function. Date is not getting stored in database. It gives the error that string cant be converted to date. But it was working fine. and also when i select data from database to bind in a datatagrid then also it is giving the same error. What might be the reason? The datatype in database is DateTime. The syntax i am using is text1.text=calendar1.selecteddate insert table1(ddate) values ('" & text1.text.trim & "')
Chaitra N
try to use convert function to convert string to datatime format before saving to database
ganeshk
-
So, it is ASP.NET, but uses VBSCript on the client side ? you know you can change to javascript on a page by page basis, right ? VBScript will only run in IE. If you have an empty string, it plainly cannot be converted to a date, you need to fix your code so the string is not empty.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
I tried. This will give the following error. The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Chaitra N
-
try to use convert function to convert string to datatime format before saving to database
ganeshk
Are u asking me to use cdate function?
Chaitra N
-
Are u asking me to use cdate function?
Chaitra N
Fetch the string value and using pares method as coded below you can convert string to date datatype vb Code Dim s As String = TextBox1.Text Dim d As Date = Date.Parse(s) Response.Write(d)
ganeshk