Skip to Content
Jul 03, 2017 at 02:49 PM




I pass the data to connect to the database through this command:

report.SetDatabaseLogon(UserId, Password, ServerName, DatabaseName);

When I open the report , It asks for the password instead the other 3 fields are filled.

In the RPT file, use the udl file to connect to the database. This is the connection string:

[oledb] ; Everything after this line is an OLE DB initstring

Provider=IBMDASQL.DataSource.1;Password=********;Persist Security Info=True;User ID=BARCODE;Data Source=*******;Initial Catalog=B00839AA

When viewing the report I used the following code:

Dim logonInfo As New CrystalDecisions.Shared.TableLogOnInfo() Dim table As Table report.Load(NomeSTP) For Each table In report.Database.Tables ' Get the TableLogOnInfo object. If table.LogOnInfo.ConnectionInfo.ServerName = "******" Then logonInfo = table.LogOnInfo ' Set the server or ODBC data source name, database name, ' user ID, and password. logonInfo.ConnectionInfo.ServerName = "" logonInfo.ConnectionInfo.DatabaseName = "B00839AA" logonInfo.ConnectionInfo.UserID = "BARCODE" logonInfo.ConnectionInfo.Password = "*********" ' Apply the connection information to the table. table.ApplyLogOnInfo(logonInfo) CrystalReportViewer1.ReportSource = report

But it doesn't work.

If you first open the preview of the report and save it Without modifying anything and then you open the report

it work correctly.

How can I fix it?