问题描述
大家好
我已经安装了Windows 7操作系统.
在此操作系统中,我已经安装了Visual Studio 2008和sql server2005.
当我使用值名称,密码和日期字段触发INSERT查询时.
我从dateTimePicker获取日期,但它在sql server中的日期数据类型问题中给出了错误.
我已经为日期字段设置了datetime数据类型.
请帮忙..
错误与日期字段的数据类型有关..
并且查询是sqlcommand cmd = new sqlcommand(插入tblLogin值(""+ txtUName.Text +"''," + txtPass.Text +'',""+ dateTimePicker.Text +"' '),con);
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);
推荐答案
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
Convert.ToDate(datepicket.value);
这篇关于Windows 7中sql server问题的datetime数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!