Hello,
Found already some samples here in the forum, but I'm getting this error:
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
cs-file:
using System;
using System.Data;
using System.IO;
using System.Configuration;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.ReportWriter;
using ceTe.DynamicPDF.ReportWriter.ReportElements;
namespace Web_CSharp.ReportWriterExamples
{
public partial class SimpleReport : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
DocumentLayout reportDetails = new DocumentLayout(@Server.MapPath("dlpx/orderconfirmation_products.dplx"));
Report rpDetails = (Report) reportDetails.GetElementById("Report1");
rpDetails.Query.ConnectionString = ConfigurationSettings.AppSettings["sqlConn"].ToString();
...
dlpx-file:
<?xml version="1.0"?>
<document id="SimpleReport" xsi:schemaLocation="http://www.DynamicPDF.com http://www.DynamicPDF.com/schemas/DPLX.xsd" author="" keywords="" title="" subject="" version="4" xmlns="http://www.DynamicPDF.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<report id="Report1" pageOrientation="portrait" pageSize="a4" bottomMargin="35" leftMargin="35" rightMargin="35" topMargin="35">
<query id="Query1" connectionString="Data Source=" dataProvider="msSql">
<sql>...
Dynamically changing the connectionstring
Re: Dynamically changing the connectionstring
Support · Sep 4, 2007Hello,
Can you please send over the dplx file and the code you are using to run the report to our [^a|mailto:support@cete.com|Support Team^] so that they can take a look at it. Also please send the sql scripts which can create a sample database and some sample data to recreate this error at our end.
Thanks,
ceTe Software Support Team.
Re: Dynamically changing the connectionstring
Support · Sep 4, 2007Hello,
The error you are getting is most probably because of the code you are using to change the connection string. Please try using the following sample code and it will work.
DocumentLayout report = new DocumentLayout( @"C:\Temp\file.dplx" );
Query query = (Query)report.GetQueryById("Query1");
query.ConnectionString = ConfigurationSettings.AppSettings["sqlConn"].ToString();
Document document = report.Run();
document.DrawToWeb();
Thanks,
ceTe Software Support Team.
Re: Dynamically changing the connectionstring
Forum member · Sep 4, 2007hello,
I'm working with System.Web.UI.Page, can that be the reason I nog get an other error ?
Now it gives this error:
CS0246: The type or namespace name 'Query' could not be found (are you missing a using directive or an assembly reference?)
This is my code:
DocumentLayout reportDetails = new DocumentLayout(@Server.MapPath("dlpx/orderconfirmation_products.dplx"));
Query query = (Query)reportDetails.GetQueryById("Query1");
query.ConnectionString = ConfigurationSettings.AppSettings["sqlConn"].ToString();
Re: Dynamically changing the connectionstring
Support · Sep 4, 2007Hello,
Using the System.Web.UI.Page will not be a problem. The error you are getting is because you are not importing the required namespace. Please import the following nameapce in your application to acces the Query class.
C# Code:
using ceTe.DynamicPDF.ReportWriter.Data;
Thanks,
ceTe Software Support Team.
Re: Dynamically changing the connectionstring
Forum member · Sep 4, 2007thank you !!! indeed, i had only the first 3 ones and added the 4th
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.ReportWriter;
using ceTe.DynamicPDF.ReportWriter.ReportElements;
using ceTe.DynamicPDF.ReportWriter.Data;