While working on setting up user accounts, I wanted to see if the values already existed in a database to alert the user before submitting the data. While doing this, I came to an issue. The issue is when I went the MS SQL SMS and tried writing a test query, I couldn't figure out how to write it in one select statment.
DECLARE @maybe bit IF exists( SELECT * FROM UserList WHERE UserName = 'Tester') SET @maybe = 1 ELSE SET @maybe = 0 SELECT @maybe
Now the issue comes in when I try to move this code over to C#. I am trying to do this with out creating stored procedures because I have many different tables and columns and would prefer writing the code on the System.Data.SqlClient.SqlCommand. Or the best solution is writing a stored procedure where could I make the "FROM Table" and "WHERE Column" parameters passed in from C#
Thanks for all the help,