You can edit Command all you want, just make sure the SQL is valid:
// check if the report is based on a Command and if so then display the SQL. This causes a huge delay opening report
btnReportObjects.AppendText("");
dtStart = DateTime.Now;
int dbConCount = rptClientDoc.DatabaseController.GetConnectionInfos().Count;
difference = DateTime.Now.Subtract(dtStart);
btnReportObjects.Text += "GetConnectionInfos().Count took: " + difference.Minutes.ToString() + ":" + difference.Seconds.ToString() + "\r\n";
String DBDriver = "";
for (int x = 0; x < dbConCount; x++)
{
try
{
DBDriver = rptClientDoc.DatabaseController.GetConnectionInfos()[x].Attributes.get_StringValue("Database DLL").ToString();
btnDBDriver.Text += DBDriver + " :";
if (((dynamic)rptClientDoc.Database.Tables[0].Name) == "Command")
{
CrystalDecisions.ReportAppServer.Controllers.DatabaseController databaseController = rpt.ReportClientDocument.DatabaseController;
ISCRTable oldTable = (ISCRTable)databaseController.Database.Tables[0];
btnSQLStatement.Text = "Report is using Command Object: \n" + ((dynamic)oldTable).CommandText.ToString();
btnSQLStatement.Text += "\n";
IsLoggedOn = false;
IsCMD = true;
}
if (DBDriver.ToString() == "crdb_bwmdx.dll")
IsBEX = true;
}
catch (Exception ex)
{
//btnDBDriver.Text = "ERROR: " + ex.Message;
btnDBDriver.Text += "Main Report has no Data Driver";
}
}
Need to use RAS to get/set the SQL in a Command.
Try doing this in CR Designer, change the parameters, the work flow will be the same in code...
Don