I have two tables (client) and (invoice), to register an invoice I am doing it this way:
SqlCommand query = new SqlCommand("insert into factura (identificacion, nombrecp, " + "fecha, iva, tipo, vtotal, descripcion, subtotal) " +
"values ('" + idCliente.Text + "', '" + nombreCliente.Text +
"', '" + fecha.Text + "', '" + IVA.Text + "', '" + tipoFactura.Text +
"', '" + totalPagar.Text + "', '" + descripcion.Text +
"', '" + Subtotal.Text + "')", conexion);
I have not found a way to make a query that by the invoice number tells me which client is associated, the value and the product that I buy. I searched the internet and what I find everything I find every time enmeshes me more. The table is related 1: M, I hope you can help me as soon as possible! : (
the code I'm using for the query is this:
select identificacionc, nombre
from cliente cli inner join factura fac
on fac.identificacion = fac.identificacion
where numero = 32;
I look at a page I tried to use it but I do not understand the whole query well and it does not show all the data I need.