Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all

i have installed windows 7 operating system.
In this OS i have installed visual studio 2008 and sql server 2005.


when i fire INSERT query with the values name,password and date field.
i am taking date from dateTimePicker ,but it gives error in datatype problem of date in sql server.

i have set datetime datatype for date field.


please help..

the error is about datatype of date field..

and the query is sqlcommand cmd=new sqlcommand("insert into tblLogin values('" + txtUName.Text + "','" + txtPass.Text + "','" + dateTimePicker.Text + "')",con);
Posted
Updated 18-Sep-11 19:10pm
v3
Comments
Herman<T>.Instance 19-Sep-11 0:58am    
what error is given?
what code have you written to do this?
Prerak Patel 19-Sep-11 1:09am    
Show your query.
hitech_s 19-Sep-11 1:19am    
is datetimepicker textbox or datetimepicker control in win applications?

if it is a control u need to use datetimepicker.value not text to get the date time
yogesh89 19-Sep-11 1:21am    
datetimepicker is windows control in win applications.....

SQL
is datetimepicker textbox or datetimepicker control in win applications?

if it is a control u need to use datetimepicker.value not text to get the date time


sorry if mis understand
 
Share this answer
 
Comments
yogesh89 19-Sep-11 1:27am    
thnks.... it works......
use
C#
Convert.ToDate(datepicket.value);
 
Share this answer
 
Comments
yogesh89 20-Sep-11 6:21am    
where did you get ToDate method in .Net ????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900