Converting the select string made by two other selects in Access database into select for filling the dataset in C# windows form RRS feed

  • Question

  • Hi,

    I have an access  database with three tables. I made one query using two other from the same database to form the select I need. But now I don't know how to convert it in select which would work in my C# windows form as well. I use this select to fill the dataset for making the crystal report later.

    Here is the select I have in access query:

    SELECT firstquery.GBR, firstquery.Gorivo, secondquery.SUMKM, ((firstquery.Gorivo/secondquery.SUMKM)*100) AS Prospotrgor, firstquery.Addblue, firstquery.Addbluegor, firstquery.Antifriz, firstquery.Motmaslo, secondquery.pockm, secondquery.krajkm, secondquery.RAZLIKA, secondquery.Poslprov, secondquery.Poslserv, secondquery.Zabeleska
    FROM firstquery LEFT JOIN secondquery ON firstquery.GBR = secondquery.GBRV;

    firstquery is the name of the first query with the first select statement, and secondquery of the second query respectively.

    Could anybody help me please?

    Thank you in advance


    • Edited by pet06 Wednesday, November 30, 2011 8:36 PM
    Wednesday, November 30, 2011 5:41 PM


All replies

  • Greetings pet06, your best solution is to create one select statement which matches what was done using the one select and two other selects since OleDb provider does not support how you wrote your select statement above. In this case it would be prudent to write the SQL outside of MS-Access to ensure you do not use anything that is MS-Access only but instead proves to work in the OleDb provider.

    If you are not sure how to create one select with multiple joins you might want to ask for assistance in the Access for Developers forum for the SQL construction.


    Thursday, December 1, 2011 10:03 PM
  • Hi pet06,

    Based on the issue, I think you can get more help from T-SQL Forum or Access for Developers Forum.

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, December 2, 2011 2:06 AM
  • I have solved it.
    • Marked as answer by pet06 Saturday, December 3, 2011 8:02 AM
    Saturday, December 3, 2011 8:02 AM