PLZ帮助解决这个问题...... [英] plz help solve this prblm...
本文介绍了PLZ帮助解决这个问题......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用窗口表单应用程序中的datetimepicker控件在两个日期之间从数据库中搜索数据#cn
解决方案
Hi
希望这会有所帮助
你应该在sql表中设置你的数据类型必须是Date
SELECT * FROM tableName WHERE 日期 BETWEEN 'Datetimepicker1.Text' AND 'Datetimepicker1.Text'
>
你在Varchar数据类型中声明了SqlVariable。所以你必须在值的前后加上单引号。
SqlCommand cmd = new SqlCommand( select * from tbadd where Dop between(@ param1)and(@ param2),co N);
cmd.Parameters.Add( @ param1,SqlDbType.VarChar, 50 )。值= ' + dateTimePicker1.Value +'跨度>;
cmd.Parameters.Add( @ param2,SqlDbType.VarChar, 50 )。值= ' + dateTimePicker2.Value +'跨度>;
how to search data from database between two dates using datetimepicker control in window form application asp.net C#
解决方案
Hi Hope this will help
you should set your datatype in sql table must be Date
SELECT * FROM tableName WHERE Date BETWEEN ‘Datetimepicker1.Text’ AND ‘Datetimepicker1.Text’
Hi,
you declare the SqlVariable in Varchar data type.so u must give the single quote in front and rear of the value.
SqlCommand cmd = new SqlCommand("select * from tbadd where Dop between (@param1) and (@param2)", con); cmd.Parameters.Add("@param1", SqlDbType.VarChar, 50).Value = '"+dateTimePicker1.Value+"'; cmd.Parameters.Add("@param2", SqlDbType.VarChar, 50).Value ='"+dateTimePicker2.Value+"';
这篇关于PLZ帮助解决这个问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文