Funky error in .NET OleDBDataProvider

  • Thread starter Thread starter Martin SChukrazy
  • Start date Start date
M

Martin SChukrazy

Hello
I am trying to create an OleDBDataProvider using the following the query

SELECT Category.categoryName, Questions.pointHigh, Questions.pointLow,
Questions.pointMiddle, Questions.questionDesc, Questions.questionId,
Questions.questionWeight, Questions.questionTypeId, Questions.rangeBelow,
Questions.rangeHigh, Questions.rangeMedium, Category.categoryId,
Category.categoryWeight, Company.companyId, Company.companyAddressField2,
Company.companyAddressField1, Company.companyName, CompanyQuestions.value
FROM ( Questions INNER JOIN Category ON Questions.categoryId =
Category.categoryId )INNER JOIN ( CompanyQuestions INNER JOIN Company ON
CompanyQuestions.companyId = Company.companyId ) ON Questions.questionId =
CompanyQuestions.questionId

This works perfectly fine on access. However whenever i try to save the
query in the DataProvider Configuration Window it changes the query to
(removes the brackets)

SELECT Category.categoryName, Questions.pointHigh, Questions.pointLow,
Questions.pointMiddle, Questions.questionDesc, Questions.questionId,
Questions.questionWeight, Questions.questionTypeId, Questions.rangeBelow,
Questions.rangeHigh, Questions.rangeMedium, Category.categoryId,
Category.categoryWeight, Company.companyId, Company.companyAddressField2,
Company.companyAddressField1, Company.companyName, CompanyQuestions.value
FROM Questions INNER JOIN Category ON Questions.categoryId =
Category.categoryId INNER JOIN CompanyQuestions INNER JOIN Company ON
CompanyQuestions.companyId = Company.companyId ON Questions.questionId =
CompanyQuestions.questionId

And as a result i get an sql syntax error.

Does any one know how to fix this? Is this a microsoft bug??

Martin
 
Hi,


Try to get:


FROM ((Questions INNER JOIN Category ON Questions.categoryId =
Category.categoryId) INNER JOIN Company
ON Questions.questionId = CompanyQuestions.questionId)
INNER JOIN CompanyQuestions
ON CompanyQuestions.companyId = Company.companyId


or, at least,


FROM Questions INNER JOIN Category ON Questions.categoryId =
Category.categoryId INNER JOIN ( CompanyQuestions INNER JOIN Company ON
CompanyQuestions.companyId = Company.companyId) ON Questions.questionId =
CompanyQuestions.questionId



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top