DataSet Bind

Stimulsoft Reports.WEB discussion
Post Reply
Mixxxa
Posts: 12
Joined: Fri Dec 02, 2011 10:09 am

DataSet Bind

Post by Mixxxa »

Hello!
Thanks for an outstanding software product!
Anyway I recently ran into sort of a problem:

DateTime df=DateTime.Now;
DateTime dt=DateTime.Now;
using (SqlConnection connection =
new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString))
{
DateTime.TryParse(DateFrom.Text, out df);
DateTime.TryParse(DateTo.Text, out dt);

connection.Open();
string sql1 = null;
SqlDataAdapter adapter = null;
DataSet dataSet = new DataSet();
StiReport report = new StiReport();

sql1 = "select ID, cost, price, AdditionDate from Orders where AdditionDate BETWEEN '" + df.ToString("yyyy-MM-dd") + "' AND '" + dt.ToString("yyyy-MM-dd") + "'";
adapter = new SqlDataAdapter(sql1,connection);

adapter.Fill(dataSet);

string appDirectory = HttpContext.Current.Server.MapPath("~/");
report.Load(appDirectory + "\\Reports\\HotelReport2.mrt");

dataSet.Tables[0].TableName = "Orders";
report.DataSources.Clear();
report.Dictionary.Databases.Clear();
report.RegData("DataSource", dataSet.Tables["Orders"]);
report.Dictionary.Synchronize();
report.Render(false);
StiWebViewerFx1.Report = report;
StiWebViewerFx1.Visible = true;
}

In report I see nothing - in designer there is an empty data source

Thank you very much
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

DataSet Bind

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduces the issue for analysis.

Thank you.
Mixxxa
Posts: 12
Joined: Fri Dec 02, 2011 10:09 am

DataSet Bind

Post by Mixxxa »

I got it guys! I mistook DataSources. Just forgot to rename separate fields in the report after I had renamed the general one. However the soft is great! Real masterpiece of .NET programming )
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

DataSet Bind

Post by Andrew »

It is great that you solved the problem. Thank you for your good words.

Have a nice day!
Post Reply