I have troubles reading an specific row from database.
I have an integer ni and I want to read only this ni row from the SQL Server database (if ni = 3 I need to read the third row).
private void intrebarea(int ni)
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * from tbl", con);
SqlDataReader rdr = cmd.ExecuteReader();
rdr.Read();
}
I thought it is possible to use
SqlCommand cmd = new SqlCommand("Select * from tbl WHERE id=ni", con);
but obviously it doesn't work.
Any ideas, please?