hi how to get the fields in the sql query from a data source

Stimulsoft Reports.NET discussion
Post Reply
miguels
Posts: 27
Joined: Tue Jun 23, 2009 5:05 pm

hi how to get the fields in the sql query from a data source

Post by miguels »

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

Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

hi how to get the fields in the sql query from a data source

Post by Alex K. »

Hello,

Can you please send us a sample for analysis.

Thank you.
Post Reply