How to compare the inserted values from sql to our windows phone 8.1 app

I am working with windows phone app 8.1. Created a registration page and login page. Inserted values successfully from registration page. the columns of table are listed below

 public class Mytable
        {
            public string Name { get; set; }
            public string Password { get; set; }
            public string Gender { get; set; }
            public string State { get; set; }
        }

How to compare them to login successfully to the next page. Please modify the below code so that the login should be successful.

 private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            
            var dbpath = ApplicationData.Current.LocalFolder.Path + "/Mydb1.db";
            var con = new SQLiteAsyncConnection(dbpath);
         
           
            List<Mytable> mylist= await con.QueryAsync<Mytable>("select * from Mytable where Name='" + text_reg.Text + "' and Password='" + text_password.Password + "'");
            foreach(Mytable r in mylist)
            {
                

                    if (r.Name == text_reg.Text && r.Password == text_password.Password)
                    {
                        var messagedialog = new MessageDialog("Successful").ShowAsync();
                    }
                    else
                    {
                        var messagedialog = new MessageDialog("successful").ShowAsync();
                    }
                

  
September 15th, 2015 2:26am