It looks like vb code if you want c# code then use following code
cmd = new SqlCommand("select name from wq where id='" + TextBox1.Text + "'", con);
con.Open();
dr = cmd.ExecuteReader();
dr.Read();
TextBox2.Text = dr[0].ToString();
dr.Close();
con.Close();
7
solved Trouble writing a select query [closed]