Looking for a specified word in a DataBase Table : I have a DataBase called LogInData, where I have information about Usernames, Password, Email address stored in a table called LOGIN. When you register you can't use an already existing username because I am using this code:


    SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Mike\Documents\LogInData.mdf;Integrated Security=True;Connect Timeout=30");
                    SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From LOGIN where Username = '" + textBox1.Text + "' and Email = '" + textBox3.Text + "'", con);
                    con.Open();

                    DataTable dt = new DataTable();
                    sda.Fill(dt);

                    if (dt.Rows[0][0].ToString() == "1")
                    {
                        MessageBox.Show("Username already existing.");
                    }

And my question is : How does this code exactly work? I know that the first line creates a connection to the database. But what about the second row  with the SqlDataAdapter and the row with the if?

Thanks a lot for the help !