datetime

  • Thread starter Thread starter Selen
  • Start date Start date
S

Selen

I use Calendar asp.net(c#).It gives me Calendar.SelectedDate.Date is string
I convert it to datetime with Convert.toDateTime but Sql server give me
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.

How can I solve the error and add date to sql server?

Thanks....
 
Ok.I did it.Thanks.But I have a another question...
Sql server my field is date time and I show it in data grid but it show
12.03.2004 00:00:00 I want the time doesnt show...How can I do that....


Thanks......
 
dSelectedDate = New Data.SqlTypes.SqlDateTime(Calendar.SelectedDate.Date)

hehe I guess something like that. You can search its document in detail from
MSDN
 
You can customize the Date Column by using Covert right from your Sql
query..
I am not sure. However, it would be something like
Select mColumn1, mColumn2, mColumn3, Covert(Char(12), mColumn4,3) as MYDATE
From WhateverTable
....
You should read SQL Servers Book Online Document. It can give you more in
detail about Date Type Format
 
Back
Top