关于批处理
窗体上有两个DTPICKER控件和一个Command控件 下面的代码我想在一个表里批量修改DTPicker1的时间该为DTPicker2,请高手指点错误之处Private Sub Command1_Click()
Dim sql As String
sql = "update jgz set 日期= DTPicker2.Value where jgz.日期= DTPicker1.Value"
exesql (sql)
End Sub
这是一个模块
Public Function exesql(ByVal sql As String) As ADODB.Recordset
sql = Trim$(sql)
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open "Provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\d.mdb"
Set rst = New ADODB.Recordset
Set rst.ActiveConnection = conn
rst.CursorType = adOpenDynamic
rst.LockType = adLockPessimistic
rst.Open sql
Set exesql = rst
Set rst = Nothing
Set conn = Nothing
End Function