sql 问题
DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)
string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+"') and (EndTime < '"+endTime+"')"
这样写有问题吗,StartTime, EndTime在数据库中是datetime类型
用messagebox('',sql)出来看看就知道了啊
调试下看看就行。where前加个空格,where字句中空格去掉, 时间用 '2009-1-1' ,注意,','需要转义。
最好的辦法是用messagebox出來看一下,SQL語句有沒問題。
用string试试
string startTime,endTime
startTime=em_1.Text
endTime=em_2.Text
string sql
sql = dw_1.GetSQLSelect()+" Where (StartTime> '"+startTime+"') and (EndTime < '"+endTime+"')"
如果你是用来根据时间查询记录的话
ls_select = "(convert(char(10),em_work.work_date,120) >= '" +ls_begin+ "') and (convert(char(10),em_work.work_date,120) <= '" + ls_end + "')"
相关问答:
小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
两种错误:
1.如果我这样申明:ResultSet rs;错误提示如下:
An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48: ......
PB中开发的。
DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)
string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+&q ......
我有一个月和日组成的数字,有两组月和日
想在身份证号中挑选出在该该两组月日之间出生的人,不知道应该怎么写.
身份证号有可能是15位或者18位
月日组合的形式如下
10-17/04-20
月-日/月- ......