private void btnCustomFind_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select Contact from Login where Username='" + txtName.Text + "' ";
txtNumber.Text = Convert.ToString(cmd.ExecuteScalar());
con.Close();
return;
}
So above is my code when the user enters their username, their contact will show.
However, due to security reasons, if the user knows 1 or more different usernames, the user can easily gather their personal particulars. I have a database called "Login" where i keep every User's login.
1) How do I limit the Find to only one user? The one user being the one who logged in.

Sachin SinghRank #66 · 26.2K reputationPosted Nov 5, 2021, 12:24 PM EDT
Samuel Toh127 reputationPosted Nov 5, 2021, 12:57 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Nov 5, 2021, 1:38 PM EDT
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Nov 6, 2021, 4:36 AM EDT