I have set the following in MSQuery.
1. MSQuery.Options.QuoteName=True
2. MSQuery.Options.QueryRecName=True
3. MSQuery.MasterFields='Title_id'. Note that I'm using Pubs db in MSSQL
4. MSQuery.DetailFields='D.Title_id'
5. MSQuery.SQL='Select * from titleauthor A join titles D on A.title_ID=D.title_ID'
When MSQuery open, it hit error "invalid column D.Title_id". When I check with SQL Profiler, it generate the following statement:
exec sp_executesql N'SELECT * FROM titleauthor A JOIN titles D on A.title_ID=D.title_ID
WHERE [D.title_id] = @P1 ', N'@P1 varchar(6)', 'PS3333'
I believe the correct statement should be :
exec sp_executesql N'SELECT * FROM titleauthor A JOIN titles D on A.title_ID=D.title_ID
WHERE D.[title_id] = @P1 ', N'@P1 varchar(6)', 'PS3333'
Thanks.
Sia