hi how to get the fields in the sql query from a data source
Posted: Thu Sep 29, 2011 12:23 pm
Hi I have a source of data with a sql query
example
select a.campo1, a.campo2, a.campo3, b.campo4, b.campo5
from table
left join table b
and the fields I need to get along with your alias and save
example
a.campo1
a.campo2
a.campo3
b.campo1
b.campo2
my code is
for (int i = 0; i < report.Dictionary.DataSources.Count; i++)
{
((Stimulsoft.Report.Dictionary.StiDataStoreSource)report.Dictionary.DataSources.Items).NameInSource = bd;
if (report.Dictionary.DataSources.Items.Name.ToString() == "Datos")
{
//sacar cadena de sql de la fuente de datos para de la vista
string strquery = ((Stimulsoft.Report.Dictionary.StiSqlSource)report.Dictionary.DataSources.Items).SqlCommand.ToString();
//sacar columnas del sql para formar el grid de la vista
for (int j = 0; j < report.Dictionary.DataSources.Items.Columns.Count; j++)
{
string columna = report.Dictionary.DataSources.Items.Columns[j].ToString();
}
}
}
but only goes in the columna variable campo1
example
select a.campo1, a.campo2, a.campo3, b.campo4, b.campo5
from table
left join table b
and the fields I need to get along with your alias and save
example
a.campo1
a.campo2
a.campo3
b.campo1
b.campo2
my code is
for (int i = 0; i < report.Dictionary.DataSources.Count; i++)
{
((Stimulsoft.Report.Dictionary.StiDataStoreSource)report.Dictionary.DataSources.Items).NameInSource = bd;
if (report.Dictionary.DataSources.Items.Name.ToString() == "Datos")
{
//sacar cadena de sql de la fuente de datos para de la vista
string strquery = ((Stimulsoft.Report.Dictionary.StiSqlSource)report.Dictionary.DataSources.Items).SqlCommand.ToString();
//sacar columnas del sql para formar el grid de la vista
for (int j = 0; j < report.Dictionary.DataSources.Items.Columns.Count; j++)
{
string columna = report.Dictionary.DataSources.Items.Columns[j].ToString();
}
}
}
but only goes in the columna variable campo1