-5

I'm new to SQL and I'm trying to create an a login using C#, .NET and SQL Server using Visual Studio and Microsoft SQL Server Management Studio.

I created a table for the users, and it looks like this:

Screenshot of the table

Then, for checking if it works, I've tried to do a simple query:

select * 
from Users 
where User = 'admin' and Password = 'admin'

But, it doesn't work. I tried to use other names without results.

I need a quick resolution for my clients. Thank you very much for your help.

If you need more information, please contact me.

Willie Cheng
  • 6,537
  • 11
  • 43
  • 63
  • 2
    sql injection alert. And do you really save passwords like this in a table? – Shmiel May 22 '22 at 14:48
  • What are types of User and Password fields? – sddk May 22 '22 at 14:59
  • See https://stackoverflow.com/a/876397/16019058 on how to store passwords. – Shmiel May 22 '22 at 15:34
  • 2
    *it doesn't work* - how?? What happens - what did you *expect* to happen? Do you get an error ? If so: ***what*** is that error? .... – marc_s May 22 '22 at 16:05
  • I dont had any error, but the code doesn't work. If it worked, I would have returned the user and password in a table. I made this script to check that it works when incrementing it in the program. Thank you for your time – studioant22 May 22 '22 at 16:12
  • 1
    Please specify the expected result and actual result from the query. – shehan pathirathna May 23 '22 at 02:56
  • Please add the DDL for this table to the question. On a lesser note, the use of Keywords for columns is perhaps not the best way to go either. – LogicalMan May 23 '22 at 11:37

0 Answers0