在某种方式
parameters @test int;
select * from MyTable where ID = @test
但是,您不能使用set @test = 1234
,在运行查询或在VBA中设置查询时可以手动输入参数。
您可以使用System.Data.OleDb命名空间中的类来查询访问数据库:
Using cn As New OleDbConnection("connection string here"), _
cmd As New OleDbCommand("SELECT query with ? parameter here", cn)
cmd.Parameters.Add("?", OleDbType.Int).Value = 1234
MyCombo@R_173_2419@.DataSource = cmd.ExecuteReader()
End Using
查询1
update MyTable2 set (...) where ID > (select max(test) from table1)
查询2
update MyTable3 set (...) where ID < (select max(test) from table1)