saeid ezzati
saeid ezzati

Reputation: 891

how change value of some DataTable columns and show them in report by stimulsoft

I have some information in a DataTable and want show them in report. I use stimulsoft for reporting.

now I want change value of some columns and show changed value in report.

this is my code:

SqlCommand sqlcom = new SqlCommand();
SqlDataAdapter sqladap = new SqlDataAdapter();
DataTable dt = new DataTable();

sqlcom.Connection = main.sqlcon;
sqladap.SelectCommand = sqlcom;

sqlcom.CommandText = "select  * from table ...";
sqladap.Fill(dt);

dt.TableName = "userhusband";
StiReport rpt = new StiReport();
rpt.Load(Application.StartupPath + @"\data\Report.mrt");
rpt.RegData(dt);
rpt.Dictionary.Synchronize();

rpt.Show();

now how change value of some columns and show in report ?

Upvotes: 0

Views: 1147

Answers (3)

HighAley
HighAley

Reputation: 1329

Just change the DataTable and register it in the report again.

Upvotes: 0

OMID
OMID

Reputation: 2739

You need to reset your report before binding again to it!

Just use rpt.Reset() in top of your report code. and in asp.net use StiWebViewer1.ResetReport() (assuming StiWebViewer1 is the element in your asp page).

Upvotes: 1

Arash
Arash

Reputation: 885

You can change the dt value like below then show it in your report

  for(int i = 0; i < dt.Rows.Count; i++)
    {
      dt.Rows[i][columnNumber] = "newValue"; }
    }

Upvotes: 0

Related Questions