cancel
Showing results for 
Search instead for 
Did you mean: 

Logon prompt after change Database location

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

This is what I did to change the database location that linked to the report.

since then I'm getting this logon prompt.

I even create a new report using the same connection to the same database and got the same result.

Thanks,

Former Member
0 Kudos

Is Reports work fine in Crystal reports designer?

Are you are getting issue through code?

Let us know your line of code.

Regards,

Shweta

Former Member
0 Kudos

yes it does I can switch to preview mode with no problem

Former Member
0 Kudos

Nagi check that have you written code for database logon.

Regards,

Shweta

Former Member
0 Kudos

if you mean set the database location before calling the report on my ASP.net code behind page

I'm not

Former Member
0 Kudos

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

Former Member
0 Kudos

do you mind sending me a VB version of this code.

Thanks,

Edited by: Nagi Tawfik on Oct 9, 2008 1:19 AM

Former Member
0 Kudos

Hi Nagi,

Download Sample codes from the following link:

[https://boc.sdn.sap.com/codesamples]

Regards,

Shweta

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

Hi Don,

Sorry about the upgrade confusion

I upgrade from .net 2005 to CR .net 2008

Also I added the formula in the Report Designer and it works fine

I'm passing the formula though my code because the dates Value is variable.

Thanks,

0 Kudos

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

Former Member
0 Kudos

Don,

I was able to pass the login info to the report and it display fine in the web but now when I hit print or export it gives me the logon prompt

any idea?

thanks,

Nagi

Former Member
0 Kudos

this is the error I'm getting by clicking print

Failed to open the connection. Details: [Database Vendor Code: 4060 ] Failed to open the connection. events01 {1AFD27E5-812A-4B91-8587-48986403129A}.rpt Details: [Database Vendor Code: 4060 ]

0 Kudos

Hi Nagi,

Search Microsofts MSDN site and found this link for that error code:

http://social.msdn.microsoft.com/Forums/en-US/vscrystalreports/thread/5710f093-2cc2-45d1-a310-e33789...

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

Former Member
0 Kudos

I found this article before but it didn't help and I'm not using a saved data.

I'm using the sa account with should have all the right to access the view I based my report on

0 Kudos

Hi Nagi,

SQL 2005 doesn't give full rights with the SA account. I suggest you create a new user that has full rights and use it in your app.

Thanks agian

Don

Answers (0)