TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ross Murray
NA
3
1.2k
SQL does not return rows using variable in string
Jul 28 2013 12:36 PM
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]
Reply
Answers (
2
)
Sql query
Msg 208, Level 16, State 3, Procedure AddRegistrationFormNew