namespace iss_farmacie_spitali
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlDataReader reader = null;
DataTable table = null;
try
{
sqlConnection1.Open();
}
catch(Exception f)
{
Console.WriteLine(e.ToString());
}
sqlCommand1.Parameters.AddWithValue("@user",textBox1.Text);
sqlCommand1.Parameters.AddWithValue("@pass",textBox2.Text);
sqlCommand1.CommandText = "SELECT id,parola FROM ANGAJAT WHERE id='@user' AND parola='@pass'";
reader = sqlCommand1.ExecuteReader();
table.Load(reader);
sqlConnection1.Close();
}
}
}
So i'm trying to do my faithful logon here, but i keep getting the null reference error. What i need help with is a bit of understanding how to handle the data i get from sql, and how to make it useable as strings and whatnot.