Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 6:55
mentorNot Active8-Jan-09 6:55 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 7:21
suni_dotnet8-Jan-09 7:21 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 7:23
mentorNot Active8-Jan-09 7:23 
AnswerRe: Error converting data type nvarchar to datetime, any suggestion Pin
musefan8-Jan-09 5:37
musefan8-Jan-09 5:37 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 5:51
suni_dotnet8-Jan-09 5:51 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
musefan8-Jan-09 6:03
musefan8-Jan-09 6:03 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 6:29
suni_dotnet8-Jan-09 6:29 
AnswerRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 6:15
Jon Rista8-Jan-09 6:15 
Don't convert in the database. You should convert in C# first, because .NET handles times in a completely different way than SQL Server. SQL Server requires times input as strings to follow a specific format. If you convert in C# first, ADO.NET will take care of the rest:

string freedateraw = Gridview2.Rows[e.RowIndex].Cells[3].Text;
DateTime? freedate = (freedateraw == null ? (DateTime?)null : Convert.ToDateTime(freedateraw));

cmd.Parameters.AddWithValue("@freedate", freedate);

GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 6:31
mentorNot Active8-Jan-09 6:31 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 7:31
Jon Rista8-Jan-09 7:31 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Not Active8-Jan-09 8:06
mentorNot Active8-Jan-09 8:06 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 8:16
Jon Rista8-Jan-09 8:16 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 6:55
suni_dotnet8-Jan-09 6:55 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 7:34
Jon Rista8-Jan-09 7:34 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 7:53
suni_dotnet8-Jan-09 7:53 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 8:06
Jon Rista8-Jan-09 8:06 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 8:28
suni_dotnet8-Jan-09 8:28 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 9:12
Jon Rista8-Jan-09 9:12 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
suni_dotnet8-Jan-09 9:49
suni_dotnet8-Jan-09 9:49 
GeneralRe: Error converting data type nvarchar to datetime, any suggestion Pin
Jon Rista8-Jan-09 10:17
Jon Rista8-Jan-09 10:17 
QuestionEventhandle !!! Pin
RongNK8-Jan-09 4:36
RongNK8-Jan-09 4:36 
AnswerRe: Eventhandle !!! [modified] Pin
Wendelius8-Jan-09 4:41
mentorWendelius8-Jan-09 4:41 
GeneralRe: Eventhandle !!! Pin
RongNK8-Jan-09 5:05
RongNK8-Jan-09 5:05 
GeneralRe: Eventhandle !!! Pin
Wendelius8-Jan-09 5:33
mentorWendelius8-Jan-09 5:33 
AnswerRe: Eventhandle !!! Pin
Le centriste8-Jan-09 4:44
Le centriste8-Jan-09 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.