如果你的audioId段是Key鍵,那就可以寫一條SQL語句完成啊。
strSQL = "select A.字段,A.字段,...,count(B.audioId) as commcount from A inner join B on A.audioId = b.audioId where A.UserId = " + uid + " Group by A.字段,A,字段,...,"
strSQL = "select A.字段,A.字段,...,isnull((count(B.audioId) as commcount),0) from A inner join B on A.audioId = b.audioId where A.UserId = " + uid + " Group by A.字段,A,字段,...,"
strSQL = "select A.字段,A.字段,...,isnull(count(B.audioId) ,0)as aa from A FULL OUTER join B on A.audioId = b.audioId where A.UserId = " + uid + " Group by A.字段,A,字段,...,"