Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
SQL does not return rows using variable in string
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Ross Murray
11y
988
1
Reply
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]
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Sql query
Msg 208, Level 16, State 3, Procedure AddRegistrationFormNew