'login: after entering user information, membership in the 0th index in the sql table is always displayed
I want to make a registration and login system. It is possible to register, the user information is saved in the sql table, but if the user wants to log in, the user in the 0th index in the sql table seems to be logged in. I tried to bring the user information on the main screen with conditional sql commands, but for example, if I check the phone number and get the information, it still gets the phone number in the 0th index.
//this is the code i am trying to get username to label
MainMenu mainMenu = new MainMenu();
if (connection.State == ConnectionState.Closed)
{
connection.Open();
}
command.Connection = connection;
command.CommandText = "select First_Name from ACCOUNTS where Phone_Number=@Phone_Number";
command.Parameters.Add("@Phone_Number", PhoneNmb.Text);
string ClientName= (string)command.ExecuteScalar();
//PhoneNmb.Text is login screens textbox.text
label.Text = "Hoşgeldiniz " + ClientName;
if (connection.State == ConnectionState.Open)
{
connection.Close();
}
Accounts table data:

Accounts table view designer (ID SPECİFİCATİONS TRUE):

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
