strsql必须自己全部重新写的for example:select book.书名,book.分类号,borrow.借出日期 from book inner join borrow " _ & " on book.bookID = borrow.bookID where readerID=" & ReaderID & " book.分类号 in [....]" 不能使用adodc的
另外你也可以试试这个 select * from (select * from book wher ....) as a where ....
dim strSql as string strsql=adodc1.RecordSource adodc2.RecordSource="select * from (" & strsql & ") as a where " & [你的条件]
strSQL = "select * from Adodc1 where 分类号 in [select * from adodc2 ]",呵呵,你还很能创造哦。 如果你对性能关心呢,使用上面的代码,注意,in子句必须只返回一列,用 *不行的,明确指明列名。如果不关心性能,在客户端装配strSQL好了, strSQL = "(" While not adoRS1.eof strSQL = strSQL & adoRS1.fileds("ddd").value adoRS.movenext wend adors.close strSQL = "select * from Adodc1 where 分类号 in " & strSQL & ")" 再执行。
我用的是access2000,不知道能否支持复杂的SQL查询。时间很紧呢,头都想大了。 select * from Adodc1 这样写肯定是不对的,但我要表达的就是这个意思。心里有点模糊,不知道这个功能怎么实现,唉,多表查询!4个表。
& " on book.bookID = borrow.bookID where readerID=" & ReaderID & " book.分类号 in [....]"
不能使用adodc的
select * from (select * from book wher ....) as a where ....
strsql=adodc1.RecordSource
adodc2.RecordSource="select * from (" & strsql & ") as a where " & [你的条件]
如果你对性能关心呢,使用上面的代码,注意,in子句必须只返回一列,用
*不行的,明确指明列名。如果不关心性能,在客户端装配strSQL好了,
strSQL = "("
While not adoRS1.eof
strSQL = strSQL & adoRS1.fileds("ddd").value
adoRS.movenext
wend
adors.close
strSQL = "select * from Adodc1 where 分类号 in " & strSQL & ")"
再执行。
select * from Adodc1 这样写肯定是不对的,但我要表达的就是这个意思。心里有点模糊,不知道这个功能怎么实现,唉,多表查询!4个表。
确实,手工书写SQL语句会有很大的性能好处。
http://www.csdn.net/expert/topic/656/656744.xml?temp=.3842127这个帖子就不要再回了,我要结帖了。