datetime

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

Selen

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

Dang Tran

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

hehe I guess something like that. You can search its document in detail from
MSDN
 
D

Dang Tran

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top