I just started coding with C# and SQL this week to create a desktop application; after login I want to put the user data who logged in other form # dashboard, but I couldn't find a way to do this. I found a way to create a class and put that user data in it so you can grab; but I am really stuck here.
public void bunifuFlatButton1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-R3ILNJ7;Initial Catalog=Project2;Integrated Security=True");
String query = "SELECT * FROM USERDB WHERE PRENOM='" + alphaBlendTextBox1.Text + "'AND PASS='" + alphaBlendTextBox2.Text + "'";
SqlDataAdapter sda = new SqlDataAdapter(query, con);
DataTable dtbl = new DataTable();
sda.Fill(dtbl);
if(dtbl.Rows.Count == 1)
{
string name = dtbl.Rows[0]["Nom"].ToString();
this.Hide();
Form1 f1 = new Form1();
f1.ShowDialog();
}
else
MessageBox.Show("mauvais password try again");
}