This is a migrated thread and some comments may be shown as answers.

Format of the initialization string does not conform to specification starting at index 0.

9 Answers 653 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Quick
Top achievements
Rank 1
Quick asked on 22 Mar 2010, 06:02 PM
An error has occured while processing Report '':
Format of the initialization string does not conform to specification starting at index 0.

I get this error message when I disable "report1.DataSource = SqlDataSource1". But there is same SqlDataSource1 in the report file (vwReport2010/test0318) already. And I can see the preview report on report design mode.

When I enable  "report1.DataSource = SqlDataSource1", it works. Does it mean I have to add same SqlDataSource in the web form every time?

Defalult.aspx:

<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

 

<%

@ Register Assembly="Telerik.ReportViewer.WebForms, Version=4.0.10.310, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"

 

 

Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

head runat="server">

 

 

<title></title>

 

 

<style type="text/css">

 

 

form#form1, div#content

 

{

 

height: 100%;

 

}

 

</style>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<script type="text/javascript">

 

 

//Put your Java Script code here.

 

 

</script>

 

 

<div id="content">

 

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:VenueWest2007ConnectionString %>"

 

 

SelectCommand="SELECT dbo.vw_promotion_code.*

 

FROM dbo.vw_promotion_code">

 

<SelectParameters>

 

 

</SelectParameters>

 

 

</asp:SqlDataSource>

 

 

<telerik:ReportViewer ID="ReportViewer1" runat="server" Height="100%" Width="100%">

 

 

</telerik:ReportViewer>

 

 

</div>

 

 

</form>

 

</

 

body>

 

</

 

html>

Default.vb:

 

Imports

 

Telerik.Web.UI

 

 

 

Imports

 

vwReport2010

 

 

 

Imports

 

System.IO

 

 

 

Partial

 

Class _Default

 

 

Inherits System.Web.UI.Page

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

If Not Page.IsPostBack Then

 

 

 

 

 

Dim report1 As New test0318

 

 

'report1.DataSource = SqlDataSource1

 

 

 

 

ReportViewer1.Report = report1

 

End If

 

 

 

 

 

End Sub

 

End

 

Class

 

9 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 22 Mar 2010, 07:00 PM
Hello Quick,

This error means that the report is unable to connect to the database. Please verify that your connection string is valid and in case you use a connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application as well.

Regards,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Quick
Top achievements
Rank 1
answered on 22 Mar 2010, 07:25 PM
Hi Steve,

Thank you for quick reply. I just double check the connection string. I believe everthing is correct. I can see the report when I click "preview" in the report design mode.  I set up same connection string on the web form, and add the same SqlDataSource. The problem is when I use SqlDataSource of web form, it works. If I disable the SqlDataSource of web form, it shows error message. But the report is working fine on the report design mode. What's wrong on it?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name='VenueWest2007' connectionString='Data Source=www.venuewest.com;Initial Catalog=VenueWest2007;Persist Security Info=True;User ID=venuewest_web;Password=***' providerName='System.Data.SqlClient' />
    </connectionStrings>
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                 initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
</configuration>
0
Steve
Telerik team
answered on 23 Mar 2010, 12:14 PM
Hi Quick,

Please read our previous reply carefully: "In case you use a connection string from the application configuration file (of the class library), make sure the name is correct and the same connection string settings are present in the configuration file of your application as well."

In other words if the correct connectionString from your class library is:

<add name='VenueWest2007' connectionString='Data Source=www.venuewest.com;Initial Catalog=VenueWest2007;Persist Security Info=True;User ID=venuewest_web;Password=***' providerName='System.Data.SqlClient' />

you should copy it to the web.config of your website as well.

Greetings,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Congero
Top achievements
Rank 1
answered on 03 Apr 2010, 02:56 AM
I am experiencing the same error in a Winforms application.  The only connection string in use is the connection string embedded in the report via the sqlDataSource.  The report renders perfectly in the design preview for winforms and  html.

this is the code in my code behind
        public Form1()
        {
            InitializeComponent();
            Report1 report = new Report1 ();
            ReportViewer1.Report = report;
        }
0
Chavdar
Telerik team
answered on 05 Apr 2010, 03:05 PM
Hi Reggie Tyler,

Note that you should use the full name of the connection string. You can find it in the app.config file of the class library. After locating it, just copy and paste it in the respective section of the web.config file of the Web Site/Application and the App.config file of the WinForms application. See the attached screenshots for reference.

If you still experience the problem, please send us a sample solution which reproduces the issue in a support ticket for us to investigate it locally.

Best wishes,
Chavdar
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Congero
Top achievements
Rank 1
answered on 05 Apr 2010, 08:02 PM
Hi Chavdar
Thanks for your reply. It works like a charm!!

0
Tuan
Top achievements
Rank 1
answered on 16 Dec 2010, 04:39 AM
Thank admin,

It's correct.
For me I use connection name when connect,
I missed use ConfigurationManager.ConnectionString["ConnectionName"] to get connection.

Thank for your help.
0
Houdini
Top achievements
Rank 1
answered on 17 Apr 2012, 03:47 PM
Thanks Steve, this really helped.
0
Mark
Top achievements
Rank 1
answered on 27 Oct 2013, 03:03 PM
I had this problem in a winform application and I realized that I had forgotten to include the executable.exe.config file with the executable.  

Also if you want to read what the connection string text is at run time in a winforms application, you need to add the reference to the .net component System.Configuration in the .NET area of the "Project" -> "Add Reference" menu item, then where you want to show the screen in your app add the following:

At the top of the form or module add:

Imports System.Configuration

Then to view the connection strings just use the following code:

MsgBox(System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionStringName").ToString())

Where ConnectionStringName is the name you used in the app.config file and in your reports.
Tags
General Discussions
Asked by
Quick
Top achievements
Rank 1
Answers by
Steve
Telerik team
Quick
Top achievements
Rank 1
Congero
Top achievements
Rank 1
Chavdar
Telerik team
Tuan
Top achievements
Rank 1
Houdini
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or