public static void addUsertoDB(dbClasses obj) { using (var conn = new SQLiteConnection(dbname)) { using (var statement = conn.Prepare(@" insert into Users (first_name,last_name,email_id) values(?,?,?); ")) { statement.Bind(1, obj.first_name); statement.Bind(2, obj.last_name); statement.Bind(3, obj.email_id); statement.Step(); } } }
private void btAddUser_Click(object sender, RoutedEventArgs e) { try { dbClasses obj = new dbClasses { first_name = txbFirstName.Text, last_name = txbSecondName.Text, email_id = txbEmailid.Text }; dbHelperClass.addUsertoDB(obj); UtilityClass.MessageDialog("Let's get started", string.Format("Welcome {0}", obj.first_name)); UtilityData.objCurrentUser = obj; this.Frame.Navigate(typeof(pgCourses)); } catch (Exception) { } }