none
SQL Query is not returning any raws RRS feed

  • Question

  • Hi,

    I am getting expected raws after creating below query in access 2007 database (*.mdb). But when I am trying to execute it from Visual Studio DataSetDesinger DataTableAdaptor it dose not returns any raw. Kindly help.

    SELECT     Salary.SalaryMonth, EmployeeMaster.EmployeeCode, EmployeeMaster.LastName, EmployeeMaster.FirstName, EmployeeMaster.MiddleName,
                          Salary.LTA, Salary.LTA_Status, Salary.MDA, Salary.MDA_Status, EmployeeMaster.MicroGrade
    FROM         EmployeeMaster, Salary
    WHERE     EmployeeMaster.EmployeeCode = Salary.EmployeeCode AND ((EmployeeMaster.MicroGrade LIKE 'M#*') OR
                          (EmployeeMaster.MicroGrade LIKE 'EX*'))

    With Best Regards,



    Rajkumar

    • Moved by Cindy Meister MVP Sunday, November 29, 2009 8:17 AM not VSTO-related (From:Visual Studio Tools for Office)
    Sunday, November 29, 2009 8:05 AM

Answers

  • When you construct your sql query from ado.net to an access database you have to use % symbol instead of the * symbol
    something like this

            Dim OleCmd As OleDbCommand = New OleDbCommand("SELECT O.OrderID, C.CompanyName, O.OrderDate, " & _
                                                          "O.RequiredDate, O.ShippedDate " & _
                                                          "FROM Customers AS C INNER JOIN Orders AS O " & _
                                                          "ON C.CustomerID = O.CustomerID " & _
                                                          "WHERE (((C.CompanyName) Like 'A%'))")

    John
    • Marked as answer by Rajdip Monday, November 30, 2009 4:20 AM
    Sunday, November 29, 2009 8:49 PM