Пример #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var db = new UserControlLibrary.DBConnection(Constr);

            if (!db.Connect())
                MessageBox.Show("Database Connection Error");

            else
                MessageBox.Show("Database  Connected");
        }
Пример #2
0
        private string LoadId()
        {
            var db = new UserControlLibrary.DBConnection(Constr);

            string query = string.Format("select Id from info");

            db.Connect();

            reader=db.Select(query);

            while (reader.Read())
            {
                int sid = int.Parse(reader[0].ToString());

                IdBox.Items.Add(sid);
            }

               return "Good";
        }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var db = new UserControlLibrary.DBConnection(Constr);

            int id = int.Parse(IdTextBox.Text);

            string name = NameTextBox.Text;

            string query=string.Format("insert into info values('{0}','{1}')", id ,name);

            string r = db.Insert(query);
            if (r != "Successfully Inserted")
            {
                MessageBox.Show(r, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show(r);
            }
        }