on 10-08-2008 9:59 PM
I having a problem that I moved the database from SQL 2000 to SQL 2005 server
so I had to change the Database location on my report
after doing so every time I'm trying to view the Report though my ASP.net application it ask me for logon info.
but even with providing it with the right information the prompt come back again and again.
I also upgrade the report from 12 to 2008
I'm using MS VS.net 2005
Windows 2003 server and SQL 2005
2.0 .net framework
Please help
Hi Nagi,
Try with this:
Might be reports are loosing database connection.
Update your database from Database -> Set Datasource Location.
Now browse your reports from application.
Hope this helps!!
Regards,
Shweta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagi,
We need to pass database logon through code.
If you want to use the ReportDocument object model then you can use:
ReportDocumentObject.SetDatabaseLogon("","","Server name","Database name");
For Viewer object model you can use:
crystalReportViewer1.ReportSource = Application.StartupPath + "//..//..//Report.rpt";
foreach (CrystalDecisions.Shared.TableLogOnInfo boTableLogOnInfo in crystalReportViewer1.LogOnInfo)
{
ConnectionInfo boConnectionInfo = boTableLogOnInfo.ConnectionInfo;
boConnectionInfo.ServerName = "WIN2KAG";
boConnectionInfo.DatabaseName = "pubs";
boConnectionInfo.IntegratedSecurity = true;
}
Hope that helps!
Regards,
Shweta
I did like your sample but same problem
here is my code
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Partial Class tsReports
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
Me.crviewer.ReportSource = Server.MapPath(Me.oplReportname.SelectedValue)
ConfigureCrystalReports()
Me.Fromdate.value = Request.QueryString("SLD")
Me.toDate.value = Request.QueryString("SLD")
Me.crviewer.PrintMode = CrystalDecisions.Web.PrintMode.Pdf
Me.crviewer.HasDrillUpButton = False
Me.crviewer.HasToggleGroupTreeButton = False
Me.crviewer.SelectionFormula = "{vw_events.SiteID}=" & Session("Appid") & "and Date({vw_events.StartAt})= Date('" & Me.Fromdate.value & "') and Date({vw_events.Endby})=Date('" & Me.toDate.value & "')"
End If
End Sub
Protected Sub btnRefresh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
Me.crviewer.ReportSource = Server.MapPath(Me.oplReportname.SelectedValue)
ConfigureCrystalReports()
Me.crviewer.SelectionFormula = "{vw_events.SiteID}=" & Session("Appid") & "and Date({vw_events.StartAt})>= Date('" & Me.Fromdate.value & "') and Date({vw_events.Endby})<=Date('" & Me.toDate.value & "')"
Me.crviewer.RefreshReport()
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
Me.Master.FindControl("lbtnprint").Visible = False
End Sub
Private Sub ConfigureCrystalReports()
Dim reportPath As String = Server.MapPath(Me.oplReportname.SelectedValue)
crviewer.ReportSource = reportPath
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
SetDBLogonForReport(myConnectionInfo)
myConnectionInfo.ServerName = "sql02"
myConnectionInfo.DatabaseName = "Scheduler"
myConnectionInfo.UserID = "web"
myConnectionInfo.Password = "123"
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
ConfigureCrystalReports()
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
Dim myTableLogOnInfos As TableLogOnInfos = crviewer.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
End Sub
End Class
Hi Shweta,
I found somthing
when I call the report with out the SelectionFormula work fine even without passing the logon info in the code
but if I add this line of code it start prompt me with logon info.
hope this help solving my problem
Me.crviewer.SelectionFormula = "{vw_events.SiteID}=" & "1" & "and Date({vw_events.StartAt})= Date('10/09/2008') and Date({vw_events.Endby})=Date('10/09/2008')"
i tried to call ConfigureCrystalReports function before setting the SelectionFormula it didn't help.
Hi Nagi,
First off you originally posted this: I also upgrade the report from 12 to 2008
When you say 12 do you mean CR 2008? and 2008 is .NET version 2008?
As read you actually down graded, .NET 2005 is CR version 10.2 and .NET 2008 is CR version 10.5. CR 2008 is actually version 12.0.
Now that you have upgraded try manually adding that same formula syntax into the Report Designer to verify it works. Could be you need to format the date function and use CRDATE(). This may confirm also if MS SQL 2005 did not change their sysntax for dates.
Thank you
Don
Hi Nagi,
Thank you for clarifying. If once you added the formula in the designer try running that report and view the formula in debug mode to see what it looks like? Possibly we are formatting some character. Try modifying the formula in code get/set, to see if that works, add an extra space so you don't alter the real info and see if that works.
Thanks again
Don
Hi Nagi,
Search Microsofts MSDN site and found this link for that error code:
It would appear the user does not have access to execute the SP.
It may have worked the first time if you are viewing a report with saved data.
Thanks again
Don
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.