you need to have more than 2 select columns in your select statement to get rdr.GetString(2)
something like below
select id, istifadeciAd, istifadeciParol from Table1 where name =? and password =?
note that index is zero-based
So if you only select istifadeciAd, istifadeciParol
columns you need to read it as
string istifadeciAd = rdr.GetString(0);
string istifadeciParol = rdr.GetString(1);
And you don't need to cast the result to string
, because it is returning string
I think you need to change the parameters adding code as well,
cmd.Parameters.AddWithValue("@name", TextBox1.Text);
cmd.Parameters.AddWithValue("@password", TextBox2.Text);