Here is my call using C#
Select JobStart, JobFinalized, OrderNumber, ArrivalMileage, TotalBill as TotalJobDollars " +
" from Workdata where ShopAbbrev = '" + tempShopAbbrev + "' and JobStart > '" + tempStart +
"' and JobFinalized <= '" + tempEnd + "' and Mechanic = '" + tempEmpName + "'
here is the actual sql command
Select JobStart, JobFinalized, OrderNumber, ArrivalMileage, TotalBill as TotalJobDollars from Workdata where ShopAbbrev = 'OTWELL1' and JobStart > '7/22/2013 12:00:00 AM' and JobFinalized <= '7/27/2013 12:00:00 AM' and Mechanic = 'Anthony Otwell'
This returns 0 rows
If I assign tempEmpName the value of 'Anthony Otwell' this call works. I have never seen this before. Has anyone ever experienced this and have a resolution.
This is where I get tempEmpName
string tempEmpName = EProductionDDL.SelectedItem.ToString();
Obviously tempEmpName is assigned the correct string as displayed in the actual sql command line ???
Ross Murray
[email protected]
SQL does not return rows using variable in string
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Jul 28, 2013, 3:28 PM EDT
Ross Murray3 reputationPosted Jul 28, 2013, 3:31 PM EDT