Binding multiple db tables to dataset (union)
Hi to all!
I want to add the result of following sentence to one dataset:
cmd = new SqlCommand("SELECT v.vis_cod_paciente as 'cod. paciente',pa.pac_nombre as 'nombre paciente', " +
"v.vis_cod_personal as 'cod. doctor', p.per_nombre as 'nombre doctor', " +
"v.vis_cod_fecha as 'fecha', v.vis_motivo as 'motivo' FROM visitas v " +
"INNER JOIN PERSONAL p ON v.vis_cod_personal = p.cod_personal " +
"INNER JOIN PACIENTES pa ON v.vis_cod_paciente = pa.cod_paciente " +
"WHERE v.vis_cod_fecha='" + hoy.ToShortDateString() + "'", myConnection);
But I'd tried this:
daVisitas.SelectCommand = cmd;
daVisitas.Fill (dsAgendaVisitas, "VISITAS");
dataGrid1.SetDataBinding(dsAgendaVisitas,"VISITAS" );
..with no results at all.
The sentence works alone in a sql interpreter, but it doesn't in this way.
Anybody can help?
Thanks
-------------------------------
World only exists into your mind.
|