I have a database that stores records from a parent MDI Form, all right there.
The problem arises when I require that the records of the BD, are shown in a DataGridView that I have inside a child MDI. I have corroborated different sources:
How to show a query in a dataGridView?
Tutorial How to display MySql data in a DataGridview C #
More my queries have not been successful, since the DataGridView does not show the data. Then my code of the DatGridView and the respective Query:
var consulta = "select * from (select ID, Nombre, ApPaterno, ApMaterno, Carrera from alumno) alumno,(select ID, Nombre, ApPaterno, ApMaterno, Profesion from profesor) profesor;";
var c = new MySqlConnection("server=localhost; database=escuela; Uid=miusuario; pwd=micontrasenia");
var adaptador = new MySqlDataAdapter(consulta, c);
var commandBuilder = new MySqlCommandBuilder(adaptador);
var ds = new DataSet();
adaptador.Fill(ds);
dataGridView1.ReadOnly = true;
dataGridView1.DataSource = ds.Tables[0];
Here is my interface including the child MDI in which I want the record to be displayed: Form3 is the child MDI in which the records will be displayed, Form1 is the parent MDI.
I do not know if it has anything to do with the Query being performed inside an MDI. Thanks.
Edit:
I verify the Query that I run in the database in WorkBench to corroborate your answer:
In case the summary of the database is needed: I have a BD school within the school, I generate two tables: student and teacher , and I want to include in a query the printing of both tables.