Page 1 of 2

DataSet binding problem

Posted: Thu May 06, 2010 4:36 am
by sohailb
I use the following code to bind a DataSet:

StiReport r = new StiReport();

r.RegData(dsData.DataSetName, dsData);
r.Dictionary.ImportXMLSchema(dsData);

r.Dictionary.Synchronize();

designer.Design(r);


but it seems that no connection to DataSet can be made, I have the schema and can design the report, but no preview. And the DataSet is crossed as the attached image.

Image

DataSet binding problem

Posted: Thu May 06, 2010 8:03 am
by Jan
Hello,

Please use following code:

Code: Select all

StiReport r = new StiReport();

r.RegData(dsData.DataSetName, dsData);
r.Dictionary.Synchronize();

designer.Design(r);
Thank you.

DataSet binding problem

Posted: Sat May 08, 2010 4:05 am
by sohailb
Thank you very much for your prompt reply.

I changed the code as you advised, but the problem still persists:

DataSet dataset = dbm.Query("SELECT Alias, Fullname FROM users");

StiReport r = new StiReport();

r.RegData(dataset.DataSetName, dataset);
r.Dictionary.Synchronize();

StiWebDesigner1.Design(r);

DataSet binding problem

Posted: Mon May 10, 2010 1:24 am
by Vladimir
Hello,

You must also add database to dictionary. Please use the following code:

Code: Select all

string connString = "SELECT Alias, Fullname FROM users";
StiSqlDatabase database = new StiSqlDatabase(dataset.DataSetName, connString);
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(database);
Thank you.

DataSet binding problem

Posted: Tue May 11, 2010 11:44 pm
by sohailb
Hi,

Now, the dataset is not crossed anymore and I can drag-drop the fields to my report. But the report preview does not show any data, and when I try to use a StiWebViewer to show the saved report, it says:
"Format of the initialization string does not conform to specification starting at index 0."
and shows the following line as the error line:
StiWebViewer1.Report = r;

here is the code I am using to invoke the designer
dset = dbm.Query("SELECT Alias, Fullname FROM users");
dset.Tables[0].TableName = "users";

StiReport r = new StiReport();

string connString = "SELECT Alias, Fullname FROM users";
StiSqlDatabase database = new StiSqlDatabase(dset.DataSetName, connString);
r.Dictionary.Databases.Clear();
r.Dictionary.Databases.Add(database);


r.RegData(dset.DataSetName, dset);
r.Dictionary.Synchronize();


StiWebDesigner1.Design(r);


and to show the report:
dset = dbm.Query("SELECT Alias, Fullname FROM users");
dset.Tables[0].Rows.Add("Ali", "Ali");
dset.Tables[0].TableName = "users";

StiReport r = new StiReport();
r.Load("c:\\Users\\bakhtiari\\Desktop\\1.mrt");

string connString = "SELECT Alias, Fullname FROM users";
StiSqlDatabase database = new StiSqlDatabase(dset.DataSetName, connString);
r.Dictionary.Databases.Clear();
r.Dictionary.Databases.Add(database);


r.RegData(dset.DataSetName, dset);
r.Dictionary.Synchronize();


StiWebViewer1.Report = r;
r.Render(true);
I have added that "dset.Tables[0].TableName = "users";" lines to see if it may solve the problem, but no change.


Besides, are you sure it is a good idea to use a SELECT command here? I am going to use it as the report engine for an ERP, and the main application populates a dataset and sends it to me to create reports. The dataset I am given can be quite complex and I don't know how i should create a SELECT command to represent all the relations in it!

DataSet binding problem

Posted: Wed May 12, 2010 6:41 am
by Vladimir
Hello,
"Format of the initialization string does not conform to specification starting at index 0."
Please send us the full error stack.


For the viewer you need only register the data, creating a connection is not necessary. It is necessary only for the report designer, because the report designer stores only the data schema, the data are not transferred. Also, for these purposes, the web designer has a special GetPreviewDataSet event, where you can register data for preview.

r.Render(true);
Not necessary to render a report after the appropriation its to the viewer, as viewer knows how to do it myself.


Thank you.

DataSet binding problem

Posted: Wed May 12, 2010 10:11 am
by sohailb
Hi, Here is the error stack:

[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +4867618
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +129
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +24
Stimulsoft.Report.Dictionary.StiSqlAdapterService.CreateConnectionInDataStore(StiDictionary dictionary, StiSqlDatabase database) +432
Stimulsoft.Report.Dictionary.StiSqlDatabase.RegData(StiDictionary dictionary, Boolean loadData) +33
Stimulsoft.Report.Dictionary.StiDictionary.CreateDatabases(Boolean loadData) +142
Stimulsoft.Report.Dictionary.StiDictionary.Connect(Boolean loadData) +141
Stimulsoft.Report.Engine.StiRenderProviderV2.ConnectToData(StiReport report) +84
Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state) +1646
Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState) +795
Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState) +136
Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode) +769
Stimulsoft.Report.StiReport.Render(Boolean showProgress) +53
Stimulsoft.Report.Web.StiWebViewer.RenderReport(StiReport report) +90
Stimulsoft.Report.Web.StiWebViewer.ProcessReport() +706
Stimulsoft.Report.Web.StiWebViewer.set_Report(StiReport value) +148
Web1._Default.btnLoad2_Click(Object sender, EventArgs e) in D:\Temp\Web1\Web1\Default.aspx.cs:219
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

DataSet binding problem

Posted: Wed May 12, 2010 11:11 am
by sohailb
Hi,

I added the "GetPreviewDataSet" event, and set "e.PreviewDataSet" to my dataset, but still the preview is empty.

DataSet binding problem

Posted: Thu May 13, 2010 1:58 am
by Vladimir
Hello,

I'm sorry, it is my mistake. In the connection string parameter you must set your connection properties to your database, not to a query for it. For example:

Code: Select all

connString = "Data Source=127.0.0.1;Initial Catalog=master;Integrated Security=True"

If, after fixing the code we did, the problem still exist, please send us aspx and cs files for analysis.

Thank you.

DataSet binding problem

Posted: Mon Jun 14, 2010 5:12 am
by Rodrigo
Hello!

I have been reading very carefully this topic because I´ve the same problem.

My steps are the following:
First I Call a designer, design the report in the web browser but can not get to preview, what is wrong??

I tried to do the same locally and it works perfectly.

my code is:

Code: Select all

            StiReport re= new StiReport();
            DataSet data= new DataSet();
            bussinesAD bussines= new bussinesAD();

            data= bussines.getBussinesID(2);

            re.RegData(data);
            

            string connString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Proyects Rodrigo\\GesRes.mdf;Integrated Security=True;Connect       Timeout=30;User Instance=True";

            StiSqlDatabase database = new StiSqlDatabase(data.DataSetName,connString);
            re.Dictionary.Databases.Clear();
            re.Dictionary.Databases.Add(database);

            re.Dictionary.Synchronize();

            StiWebDesigner1.Design(re);

*Edited: informe -> re; I wrote it wrong here, sorry*

Thank you for your help!