Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Libro lb = new Libro();
            DataTable dt = new DataTable();
               string texto = textBox1.Text;
               if (id_RADIOBUTTON.Checked)
               {
               try
               {
                   Int32.Parse(textBox1.Text);
               }
               catch
               {
                   MessageBox.Show("Ingreso algun dato que no es un numero, porfavor verifique!");
                   return;
               }
               lb.buscalibro(dt, "SELECT * FROM LIBROS WHERE ID_LIBRO = " + textBox1.Text);
               }
               else
               if (libro_RADIOBUTTON.Checked)
                   lb.buscalibro(dt, "SELECT * FROM LIBROS WHERE NOMBRE = '" + textBox1.Text+"'");
               else
                   lb.buscalibro(dt, "SELECT * FROM LIBROS WHERE AUTOR = '" + textBox1.Text+"'");

            dataGridView1.DataSource = dt;
        }
Пример #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     Libro lb = new Libro();
     DataTable dt = new DataTable();
     lb.buscalibro(dt,"SELECT * FROM LIBROS");
     dataGridView1.DataSource = dt;
 }
Пример #3
0
 private void agregarLibro_Load(object sender, EventArgs e)
 {
     Libro lb = new Libro();
     DataTable dt = new DataTable();
     lb.buscalibro(dt,"SELECT * FROM LIBROS");
     dataGridView1.DataSource = dt;
     textBox1.Focus();
 }