我用两个时间插件:DTPicker1 DTPicker2 和一个按钮Command1 。选择其中的一段时间删除,在按钮中执行下面代码但是不行 请帮我看看谢谢!如果能帮我加上一个进度条那更好了
Private Sub Command1_Click()
If MsgBox("您真的要删除吗?", vbYesNo + 32, "信息删除") = vbYes Then ' 用户按下"是"
Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=hao"
strsql = "delete xx where 发送时间 >= " & "'" & DTPicker1.Value & "'and 发送时间 <= " & "'" & DTPicker2.Value & "'ORDER BY 发送时间"
Adodc1.RecordSource = strsql
Adodc1.Refresh ' 完成某操作
End If
End Sub
Private Sub Command1_Click()
If MsgBox("您真的要删除吗?", vbYesNo + 32, "信息删除") = vbYes Then ' 用户按下"是"
Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=hao"
strsql = "delete xx where 发送时间 >= " & "'" & DTPicker1.Value & "'and 发送时间 <= " & "'" & DTPicker2.Value & "'ORDER BY 发送时间"
Adodc1.RecordSource = strsql
Adodc1.Refresh ' 完成某操作
End If
End Sub
strsql = "delete xx where 发送时间 >= #" & DTPicker1.Value & "# and 发送时间 <= #" & DTPicker2.Value & "# ORDER BY 发送时间"
时间变量应用 # #,而不是用‘’
strsql = "delete from xx where 发送时间 >= #" & DTPicker1.Value & "# and 发送时间 <=#" & DTPicker2.Value & " # "sql server
strsql = "delete from xx where 发送时间 >=CONVERT(DATETIME, '" & DTPicker1.Value & "', 102) and 发送时间<=CONVERT(DATETIME, '" & DTPicker2.Value & "', 102)"
If MsgBox("您真的要删除吗?", vbYesNo + 32, "信息删除") = vbYes then
Adodc1.open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=hao"
call Adodc1.Execute ("delete xx where 发送时间 >= " & "'" & DTPicker1.Value & "'and 发送时间 <= " & "'" & DTPicker2.Value & "'ORDER BY 发送时间"
)
Adodc1.Refresh ' 完成某操作
End If
End Sub
DTStar.Value & "' and CheckInDate<='" & DTEnd.Value & "'"
在ACCESS里不能運行?請問怎樣改呀?