Good Evening,
I have issue with connection to Crystal report from web.config file .
my .aspx page is given below.
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="True" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False"
Height="811px" ReportSourceID="CrystalReportSource1" Width="2594px"></CR:CrystalReportViewer>
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="Report\RptMonthlyNetSaleByCustomer.rpt">
</Report>
</CR:CrystalReportSource>
</div>
</form>
and my aspx.cs page is given below.
protected void Page_Load(object sender, EventArgs e)
{
SqlConnectionStringBuilder SConn = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["ConnectionString"].ToString());
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
ReportDocument cryRpt = new ReportDocument();
Tables CrTables;
cryRpt.Load(Server.MapPath(@"~/Report/RptMonthlyNetSaleByCustomer.rpt"));
cryRpt.SetDatabaseLogon(SConn.UserID, SConn.Password, SConn.DataSource, SConn.InitialCatalog);
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
cryRpt.SetParameterValue("@strIDs", Session["stID"].ToString());
cryRpt.SetParameterValue("@strdtFromDate", Session["FromDate"].ToString());
cryRpt.SetParameterValue("@strdtToDate", Session["ToDate"].ToString());
CrystalReportViewer1.ReportSource = cryRpt;
}
when i run this report then i got error which is given below.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Invalid authorization specification SQL State: 28000 Error in File C:\Users\Vaquas\AppData\Local\Temp\RptMonthlyNetSaleByCustomer {1EA5CF63-EF4B-4B14-9053-FA40442011B2}.rpt: Unable to connect: incorrect log on parameters
my web.config file is given below.
<appSettings>
<add key="ConnectionString" value="Data Source=HHDVAQUAS;Initial Catalog=DeemahCurrent; User Id=sa;Password=samesame;"/>
<add key="CrystalImageCleaner-AutoStart" value="true"/>
<add key="CrystalImageCleaner-Sleep" value="60000"/>
<add key="CrystalImageCleaner-Age" value="120000"/>
</appSettings>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=HHDVAQUAS;Initial Catalog=DeemahCurrent; User Id=sa;Password=samesame;"
providerName="System.Data.SqlClient" />
<add name="DeemahTodayConnectionString" connectionString="Data Source=HHDVAQUAS;Initial Catalog=DeemahCurrent; Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
so please help me how can i do this.....