views:

248

answers:

0

My Crystal Report .rpt file has a datasource of 'dev'.

The deployment environment datasource name will vary. In my app code, I have:

SqlConnectionStringBuilder SConn = new SqlConnectionStringBuilder(connectionString);

Label myLabel = new Label();

myLabel.DataSourceConnections[0].SetConnection(SConn.DataSource, SConn.InitialCatalog, SConn.UserID, SConn.Password);

myLabel.PrintOptions.PrinterName = printerName;

myLabel.PrintToPrinter(1, false, 0, 0);

When run, Crystal complains bitterly about not being able to connect. From debug, I can see that the SCon values are all right. Could the problem be that the report datasource name is different from the SConn.DataSource value? If so, how does one 'override' the report DataSource name?