Hi,
Trying to create a .mdc file from .mdl file using C#. The following code seems to successfully load the Cognos application, open the .mdl file. When trying to create .mdc file, gives following error:
'trModel(CreateMDCFiles) : (TR0102) The process or action was cancelled at your request. '
Any help or link appreciated. thanks
Here is the code:
strModelPath = @"C:\Cognos\go_sales.mdl";
try
{
Type typeCognos = Type.GetTypeFromProgID("CognosTransformer.Application");
object objCognos = System.Activator.CreateInstance(typeCognos);
// Create the parameter list
object[] arguments = new object[] { strModelPath };
object[] argumentsMDC = new object[] {};
// Dynamically Invoke the Object
Object objresult = typeCognos.InvokeMember("OpenModel",
BindingFlags.InvokeMethod,null,objCognos,arguments);
Object resultMDC = typeCognos.InvokeMembe("CreateMDCFiles",
BindingFlags.InvokeMethod,null,objresult,argumentsMDC);
}
catch (Exception ex)
{
txtError.Text = "Main error: " + ex.Message + ex.StackTrace;
if (ex.InnerException != null)
{
txtError.Text = "Inner Exception : " + ex.InnerException.Message +
" Source " + ex.InnerException.Source +
" trace " + ex.InnerException.StackTrace;
}
}
saj
Trying to create a .mdc file from .mdl file using C#. The following code seems to successfully load the Cognos application, open the .mdl file. When trying to create .mdc file, gives following error:
'trModel(CreateMDCFiles) : (TR0102) The process or action was cancelled at your request. '
Any help or link appreciated. thanks
Here is the code:
strModelPath = @"C:\Cognos\go_sales.mdl";
try
{
Type typeCognos = Type.GetTypeFromProgID("CognosTransformer.Application");
object objCognos = System.Activator.CreateInstance(typeCognos);
// Create the parameter list
object[] arguments = new object[] { strModelPath };
object[] argumentsMDC = new object[] {};
// Dynamically Invoke the Object
Object objresult = typeCognos.InvokeMember("OpenModel",
BindingFlags.InvokeMethod,null,objCognos,arguments);
Object resultMDC = typeCognos.InvokeMembe("CreateMDCFiles",
BindingFlags.InvokeMethod,null,objresult,argumentsMDC);
}
catch (Exception ex)
{
txtError.Text = "Main error: " + ex.Message + ex.StackTrace;
if (ex.InnerException != null)
{
txtError.Text = "Inner Exception : " + ex.InnerException.Message +
" Source " + ex.InnerException.Source +
" trace " + ex.InnerException.StackTrace;
}
}
saj