please check the authentication mode of sql server , if it is windows then change it to sql authentication mode
On Jun 23, 9:48 pm, Hugo <[email protected]> wrote: > Dear Group and Stacie, > > My dev and deployment server are the same. The Crystal report displays > nice and clean in localhost, but when deployed into wwwroot of the > same system, it gives me a "Database logon failed". I have.....full > licensed version of crystal reports and VS-2008, SQL server 2008, > Windows server 2008 R2. > I have wasted too much time trying to fix it. I really need some help > from the group. I am using Crystalreport viewer and Reportsrouce in my > ASP page. > > My C# code is as below: > ================= > using System; > using System.Collections; > using System.Configuration; > using System.Data; > using System.Web; > using System.Web.Security; > using System.Web.UI; > using System.Web.UI.HtmlControls; > using System.Web.UI.WebControls; > using System.Web.UI.WebControls.WebParts; > using CrystalDecisions.CrystalReports.Engine; > using CrystalDecisions.Shared; > using System.Collections.Specialized; > using System.util; > > public partial class sample : System.Web.UI.Page > { > ReportDocument reportDocument = new ReportDocument(); > ParameterField paramField = new ParameterField(); > ParameterFields paramFields = new ParameterFields(); > ParameterDiscreteValue paramDiscreteValue = new > ParameterDiscreteValue(); > > protected void Page_Load(object sender, EventArgs e) > { > if (!IsPostBack) > { > paramField.Name = "@ProgramName"; > paramDiscreteValue.Value = "Dubai-2009"; > paramField.CurrentValues.Add(paramDiscreteValue); > paramFields.Add(paramField); > CrystalReportViewer1.ParameterFieldInfo = paramFields; > reportDocument.Load(Server.MapPath("missingdoc.rpt")); > System.Data.SqlClient.SqlConnectionStringBuilder SConn = > new > System.Data.SqlClient.SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["STD_ConnectionString"].ConnectionString); > > reportDocument.SetDatabaseLogon(SConn.UserID, > SConn.Password, SConn.DataSource, SConn.InitialCatalog); > > } > } > > protected void Button1_Click1(object sender, EventArgs e) > { > paramField.Name = "@ProgramName"; > paramDiscreteValue.Value = > DropDownList1.SelectedValue.ToString(); > paramField.CurrentValues.Add(paramDiscreteValue); > paramFields.Add(paramField); > CrystalReportViewer1.ParameterFieldInfo = paramFields; > reportDocument.Load(Server.MapPath("missingdoc.rpt")); > System.Data.SqlClient.SqlConnectionStringBuilder SConn = new > System.Data.SqlClient.SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["STD_ConnectionString"].ConnectionString); > > reportDocument.SetDatabaseLogon(SConn.UserID, SConn.Password, > SConn.DataSource, SConn.InitialCatalog); > > } > > } > > ========================= > > <form id="form1" runat="server"> > <CR:CrystalReportSource ID="CrystalReportSource1" > runat="server"> > <Report FileName="missingdoc.rpt"> > </Report> > </CR:CrystalReportSource> > > <asp:DropDownList ID="DropDownList1" > runat="server" > DataSourceID="SqlDataSource2" > DataTextField="ProgramName" > DataValueField="ProgramName" > AutoPostBack="False"> > </asp:DropDownList> > > <asp:SqlDataSource ID="SqlDataSource2" > runat="server" > ConnectionString="<%$ > ConnectionStrings:STD_ConnectionString%>" > > SelectCommand="*******************************"> > </asp:SqlDataSource> > <br /> > > <asp:Button ID="Button1" runat="server" Text="Generate > Report" > onclick="Button1_Click1" /> > > <br /> > > <br /> > > <CR:CrystalReportViewer ID="CrystalReportViewer1" > runat="server" > AutoDataBind="True" > EnableDatabaseLogonPrompt="False" > Height="1158px" ToolbarImagesFolderUrl="" > ToolPanelWidth="200px" Width="1059px" > ReportSourceID="CrystalReportSource1" > ToolPanelView="None" /> > </form> > > ====================================== > > On Feb 27 2009, 2:40 pm, Stacie <[email protected]> wrote: > > > I have aCrystalreportincluded in my web app. After deploying my > > web app to my web server when I try to access thereportI receive the > > following error "Logonfailed. Details: ADO Error Code: 0x Source: > > Microsoft OLE DB Provider for SQL Server Description: Login failed for > > user '(null)'. Reason: Not associated with a trusted SQL Server > > connection. SQL State: 42000 Native Error: Error in File C:\WINDOWS > > \TEMP\Timecard {D01BFAAC-FA1F-4D29-8C7F-456964301B5C}.rpt: Unable to > > connect: incorrect log on parameters." > > > I can access thereporton my dev server with no problems. Does > > anyone know how to fix this error?
