Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Data Source

Status
Not open for further replies.

bddsolid

Programmer
Jul 20, 2004
19
BE
We wrote a Crystal Reports Viewer in C#. The viewer works very well if we use only tables in our reports. If we use Commands, we get a logon screen. In that logon screen it is impossible to enter the Server and the Database because this fields are disabled. It is possible to enter a username and password. When I click OK, I'm in an iteration of that logon screen. Of course I don't want that logon window, because all logon parameters are in the XML file.
In our Crystal Viewer, we try to reset the the data source (using the parameters in the XML-file) for each table, but it don't work apperently for Commands. (It works for tables, not for commands)
This is the code that I use to reset the data source:
Code:
static private ReportDocument LoadReport(String reportLocation)
        {
            //ReportDocument document = new ReportDocument();
            document.Load(reportLocation);

            foreach (Table table in document.Database.Tables)
            {
                // Get the TableLogOnInfo object.
                CrystalDecisions.Shared.TableLogOnInfo logonInfo = table.LogOnInfo;

                // Set the server or ODBC data source name, database name, 
                // user ID, and password.
                logonInfo.ConnectionInfo.ServerName = serverName;
                logonInfo.ConnectionInfo.DatabaseName = databaseName;
                logonInfo.ConnectionInfo.UserID = user;
                logonInfo.ConnectionInfo.Password = password;
                                    
                // Apply the connection information to the table.
                table.ApplyLogOnInfo(logonInfo);

                table.Location = table.Location;
                
                
            }
        }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top