on 02-25-2009 7:50 PM
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.