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; }
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; }
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(); }