locked
Why is the data condition conditional in access 97 results = 0? RRS feed

  • Question

  • User-663551687 posted

    you see two query when getting data in access 97 what's wrong ? when I query conditional Microsoft Access97 results data = 0, The mean that when I input character cell the search box and press the search button, it will produce the result = 0, this is the query code:

    results = true;
    
    sSQL = "SELECT TABSANPHAM.IDMAVACH_SC, TABSANPHAM.NGAYTAO, TABSANPHAM.IDMAVACH_TS, TABSANPHAM.TENSP, TABSANPHAM.GIABAN ";
            sSQL += "FROM TABSANPHAM ";
            sSQL += "ORDER BY TABSANPHAM.TENSP;";
    
    results = false;
    sSQL = "SELECT TABSANPHAM.IDMAVACH_SC, TABSANPHAM.NGAYTAO, TABSANPHAM.IDMAVACH_TS, TABSANPHAM.TENSP, TABSANPHAM.GIABAN ";
            sSQL += "FROM TABSANPHAM ";
            sSQL += "WHERE TABSANPHAM.TENSP Like '*" + tenSanPham + "*' ";//bi lỗi dòng này ?! không tìm kiếm trong access được, trong SQL Server thì bình thường
            sSQL += "ORDER BY TABSANPHAM.TENSP;";

    This is my code: http://www.mediafire.com/file/ddedy345jo2o5mz/GetDataConditionalAccess97.rar/file

    Thursday, May 30, 2019 3:43 AM

Answers

  • User-821857111 posted

    If you are using the Jet 4.0 provider to connect to the database file, you need to change your wildcard characters to % instead of *.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 30, 2019 6:50 AM