关于使用VB.Net日期时间选择器的SQl查询 [英] about SQl Query using VB.Net Date time Picker
问题描述
和平在你身边
我正在开发一个VB.Net 2010软件,其中我有一个SQl数据库,其中每一行(Record)都有一个Date Field,我想查看所有记录对于哪个日期位于用户使用两个DateTimePickers确定的两个日期之间,我的SQl查询如下: -
Peace be Upon You
I am Developing a VB.Net 2010 Software in which i have an SQl Database in which each row (Record) has a Date Field , i want to view all the records for which the date lies between two dates which the user determines using two DateTimePickers , my SQl Query is the following:-
SELECT *
FROM Datalog
WHERE Date BETWEEN DateTimePicker1.Value And DateTimepicker2.Value
问题是在执行此SQL查询时出现多部分标识符DateTimePicker1无法绑定的错误消息,我想知道为什么我收到这条消息?
实际上我的截止日期是从2014年4月15日起的一周之后,我希望尽快找到答案!!
the problem is that when executing this SQL Query an arror message "the multipart identifier DateTimePicker1 Could not be bound " , i want to know why i'm getting this message?
Actually My Deadline is after a week from today 15 Apr 2014, i hope to find an answer ASAP!!
推荐答案
DIM Query as String = String.Format("Select * from Datalog where [Date] Between {0} and {1}", DateTimePicker1.Value, DateTimePicker2.Value)
然后对你的数据库运行查询。
DateTimePicker2不是SQL语法而是.NET
and then run the query against your database.
DateTimePicker2 is not an SQL syntax but .NET
这篇关于关于使用VB.Net日期时间选择器的SQl查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!