Sheldon Livingston
asked on
Why does changing a query cause a program to crash.
The query below returns -1 as a record count.
The query below will return a record count of 9,920.
Anyone have an idea as to why this would happen? I would think that the cursor location wouldn't matter from one query to the next.
SQLQuery = "select somast.fduedate, somast.fsono, Description, dateCreated as LastScanDate,sum(fquantity) as doorTotal " +
"from somast " +
"left outer join soitem on somast.fsono = soitem.fsono " +
"left outer join DoorTrak.dbo.Transactions on left(somast.fsono, 6) = left(DoorTrak.dbo.Transactions.SO, 6) " +
"left outer join DoorTrak.dbo.Entities on DoorTrak.dbo.Transactions.userID = DoorTrak.dbo.Entities.entityID " +
"where somast.fstatus = 'Open' and somast.fduedate >= '2-12-2018' " +
"and(fprodcl in ('SE', 'SD', 'SL', 'SM', 'SR', 'SS', 'ST', 'LV')) " +
"and dateCreated in (select max(dateCreated) from DoorTrak.dbo.Transactions where left(somast.fsono, 6) = left(DoorTrak.dbo.Transactions.SO, 6) ) " +
"group by somast.fsono, fcompany, somast.fduedate, forderdate, fordername, fprint_dt, dateCreated , Description " +
"order by somast.fduedate";
The query below will return a record count of 9,920.
SQLQuery = "select * from somast where fduedate > '2/12/2018'";
Anyone have an idea as to why this would happen? I would think that the cursor location wouldn't matter from one query to the next.
What class(es) (from which namespaces) are you using to submit the query to the database?
ASKER
I'm using ADODB if that is what you mean. Realize that the only line of code I am changing is the query.
First, I would log into the database server and run the query from there. Second, I would start with the "SELECT * FROM SOMSAT WHERE fduedate > '2/12/2018'" statement and add each additional clause until I located the one that is causing the error.
-saige-
-saige-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.