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 :)

VulpesRank #55 · 29.2K reputationPosted Sep 24, 2013, 2:35 PM EDT
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?
Joxin Stanly181 reputationPosted Sep 24, 2013, 2:50 AM EDT
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 :)
jesper89 reputationPosted Oct 1, 2013, 2:45 AM EDT
God debugging is great when i'm not tired :) so yes the OR operator worked correctly as you said vulpes :)