Skip to Content
author's profile photo Former Member
Former Member

Database logon coming up

I am trying to call a report based on an Advantage database from a .net Application. This is the code that I use

d = New ReportDocument

d.Load("C:\test\bill.rpt")

d.SetDatabaseLogon("adssys", "MCSSTIME", "taxm_narrows", "C:\Development\Customer Data\data_narrows\TaxM.add")

CrystalReportViewer1.ReportSource = d

I get no errors but the problem is that the database logon box comes up every time. Also, when the box comes up, the server name and database are greyed out but I can see that they are the server/database that the report was based on, it doesn't change

I've also tried this:

Dim ci As ConnectionInfo

ci = New ConnectionInfo

ci.DatabaseName = "taxm.add"

ci.IntegratedSecurity = True

ci.Password = "MCSSTIME"

ci.UserID = "adssys"

ci.ServerName = "taxm_narrows"

d.Database.Tables(0).LogOnInfo.ConnectionInfo = ci

and This:

d.Database.Tables(0).LogOnInfo.ConnectionInfo

.DatabaseName = "taxm.add"

d.Database.Tables(0).LogOnInfo.ConnectionInfo

.IntegratedSecurity = True

d.Database.Tables(0).LogOnInfo.ConnectionInfo

.Password = "MCSSTIME"

d.Database.Tables(0).LogOnInfo.ConnectionInfo

.UserID = "adssys"

d.Database.Tables(0).LogOnInfo.ConnectionInfo

.ServerName = "taxm_narrows"

All of them end up with the same results. I can use this same code with SQL server and it's fine. what am I missing?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 27, 2009 at 12:21 AM

    The approach I always take when I'm not sure what to set for database logon info is to design two reports. The first will connect to my original database. The second will connect to my destination database. I'll then look at all the ConnectionProperties for each Crystal Report by stepping through my .NET application.

    The one piece I noticed you missed in your code is that you are not applying any of the ConnectionInfo to your Table. You'll need to use the Table.ApplyLogonInfo() method to make sure your changes stick.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2009 at 08:05 PM

    Hi,

    Are you trying to change the database at runtime? That is are you pointing to the same database that you have used to design the reports or a different one?

    The database prompt come up when we are either dropping some table from the report.

    Also it seems that you can use the code with SQL db. Are you trying to use a ODBC connection when getting prompted? In that case try this code here we pass the dsn name as Server name and Database name should be blank:

    ConnectionInfo boconnectioninfo = new ConnectionInfo ();
    boconnectioninfo.ServerName= "mydatabase";// dsn name
    boconnectioninfo.DatabaseName ="";
    boconnectioninfo.UserID ="sa";
    boconnectioninfo.Password ="sa";
    CrystalReportViewer1 .ReportSource = Server.MapPath ("oledb.rpt");
    
    TableLogOnInfos botableInfo= CrystalReportViewer1.LogOnInfo;
    foreach (TableLogOnInfo obj2 in botableInfo)
    	{
            	obj2.ConnectionInfo =boconnectioninfo;
    	}

    Do let us know the VS and Crystal product that you are using. Do the report display properly from the designer?

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      I hope you are using Cr2008 with at least Sp0.

      • If you are changing the schema of the report at runtime, use RAS sdks.

      • If you are not changing the schema at the runtime then; Open the report in the designer, point to the target database and see if you can see data properly in the report. You might need to Update the fields of the report from the designer. For this you need to:

      Right click on the Field Explorer -> Set datasource Location.

      Create a new connection in Replace with window.

      Se3lect the same fields in the upper window and click on the update button.

      If the mapping is not proper then you will be prompted for manual mapping of fields. This would mean that the report is missing some fields while pointing to the target machine.

      Does it helps?

      AG.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.