Can any of you tell me why my OR operator dosen't work ? :)
SqlCommand cmd = new SqlCommand("SELECT userinitials, computerName FROM UserHasComputer WHERE userinitials = @userinitials OR computerName = @computerName", conn);
cmd.Parameters.AddWithValue("@userinitials", SessionWrapper.userinitials);
cmd.Parameters.AddWithValue("@computerName", SessionWrapper.computerName);
the code dont care for the computername :)
VulpesPosted Sep 24, 2013, 6:35 PM
Frankly, jesper, I can't see anything wrong with your code.
Is it possible that the variable SessionWrapper.computerName doesn't contain a computer name which is present in the database?
jesperPosted Oct 1, 2013, 6:45 AM
God debugging is great when i'm not tired :) so yes the OR operator worked correctly as you said vulpes :)
Joxin StanlyPosted Sep 24, 2013, 6:50 AM
i believe Or Condition work with a 'single column' criteria..
for eg [in this case - city]-:
SELECT *
FROM suppliers
WHERE city = 'New York'
or city = 'Newark';
please correct me if i am wrong :)