Page 1 of 1

DataSet Bind

Posted: Fri Dec 02, 2011 10:11 am
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

DataSet Bind

Posted: Mon Dec 05, 2011 12:40 am
by Alex K.
Hello,

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

Thank you.

DataSet Bind

Posted: Mon Dec 05, 2011 3:37 am
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 )

DataSet Bind

Posted: Tue Dec 06, 2011 1:56 am
by Andrew
It is great that you solved the problem. Thank you for your good words.

Have a nice day!