首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

一直没解决,该怎么处理

2012-01-10 
一直没解决in_time包含日期和时间,DTPicker1.value只有日期.现在我想取in_time的日期来和date1比较.可是比

一直没解决
in_time包含日期和时间,DTPicker1.value只有日期.现在我想取in_time的日期来和date1比较.可是比较不起.请问怎么改?
Dim   rs_windows   As   New   ADODB.Recordset
Dim   sql   As   String
Dim   date1   As   String
date1   =   Format(CDate(DTPicker1.Value),   "yyyy-mm-dd ")
sql   =   "select   *   from   information   where   mid(in_time,1,10)= ' "   &   date1   &   " '   And     flag   =   0   "
rs_windows.CursorLocation   =   adUseClient
rs_windows.Open   sql,   conn,   adOpenKeyset,   adLockPessimistic


还有一个
Dim   rs_save   As   New   ADODB.Recordset
Dim   sql   As   String
Dim   var1   As   String
Dim   i   As   Long

If   Trim(txtcar.Text)   =   " "   Then
      MsgBox   "车牌号不能为空 ",   vbOKOnly   +   vbExclamation,   " "
      txtcar.SetFocus
      Exit   Sub
End   If
If   Trim(txtphone.Text)   =   " "   Then
      MsgBox   "车主手机号不能为空 ",   vbOKOnly   +   vbExclamation,   " "
      txtphone.SetFocus
      Exit   Sub
End   If
If   Trim(cmbtype.Text)   =   " "   Then
      MsgBox   "车辆类别不能为空 ",   vbOKOnly   +   vbExclamation,   " "
      cmbtype.SetFocus
      Exit   Sub
End   If
txttime.Text   =   Now()
var1   =   cmbtype.Text
 
Select   Case   var1
  Case   "单桥车 "
                i   =   1
  Case   "双桥车 "
                i   =   2
  Case   "长车 "
                i   =   3
  Case   "吊车单桥 "
                i   =   4
  Case   "吊车双桥 "
                i   =   5
  End   Select
 

sql   =   "select   *   from   Information   "
rs_save.Open   sql,   conn,   adOpenKeyset,   adLockPessimistic

rs_save.MoveLast
conn.Execute   "insert   into   Information   values   ( "   &   rs_save.Fields(0)   +   1   &   ", ' "   &   txtcar.Text   &   " ', ' "   &   txtphone.Text   &   " ', "   &   i   &   ", ' "   &   txttime.Text   &   " ', "   &   0   &   ", "   &   userID   &   ") "
     
  MsgBox   "录入成功 "
  rs_save.Close
  txtcar.Text   =   " "
  txtphone.Text   =   " "
  cmbtype.Text   =   " "
  txttime.Text   =   " "

conn.Execute   "insert   into   Information   values   ( "   &   rs_save.Fields(0)   +   1   &   ", ' "   &   txtcar.Text   &   " ', ' "   &   txtphone.Text   &   " ', "   &   i   &   ", ' "   &   txttime.Text   &   " ', "   &   0   &   ", "   &   userID   &   ") "


执行提示至少一个参数没有被设定指定值,是怎么回事呀??

[解决办法]
你debug.print你的SQL语句,就可以看到那儿不正确了,同时也可以放到查询分析器中去分析
[解决办法]
根据vbman2003(家人)的修改建议,请你再次修改一下试试

conn.Execute "insert into Information (cl_number,cph,sj,cl_type_xh,in_time,flag,in_yg_id) values ( " & cstr(rs_save.Fields(0)) & ", ' " & txtcar.Text & " ', ' " & txtphone.Text & " ', " & cstr(Val(i)) & ", ' " & txttime.Text & " ',0, " & cstr(userID) & ") "

热点排行