一直没解决
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 & ")"
执行提示至少一个参数没有被设定指定值,是怎么回事呀??