第74集 SLQ+ADO综合实例
358、 入库、出库系统
类模块中:
Function 筛选结果(sq As String)
Dim conn As New Connection
Dim rst As New Recordset
conn.Open “provider=Microsoft.ACE.OLEDB.12.0;data source=” & ThisWorkbook.Path & “/Database/CangKu.mdb”
Set rst = conn.Execute(sq)
筛选结果 = rst.GetRows
conn.Close
Set conn = Nothing
End Function
Sub 执行sql命令(sq As String)
Dim conn As New Connection
Dim rst As New Recordset
conn.Open “provider=Microsoft.ACE.OLEDB.12.0;data source=” & ThisWorkbook.Path & “/Database/CangKu.mdb”
conn.Execute (sq)
conn.Close
Set conn = Nothing
End Sub
Function 是否存在(ku As String, zd As String, zh As String) ‘ku指定查找的表,zd是判断的字段,zh 是值
Dim conn As New Connection
Dim rst As New Recordset
Dim sql As String, arr
conn.Open “provider=Microsoft.ACE.OLEDB.12.0;data source=” &am