If I do a C# foreach() loop, then I can iterate through each column. But if I try to do the following then objProc.ResultColumns[i] always returns null.
- Code: Select all
ArrayList procNames = (ArrayList)input[\"lstProcs\"];
string databaseName = (string)input[\"cmbDatabase\"];
IDatabase database = MyMeta.Databases[databaseName];
// Loop through the procs the user selected and generate the business entities
for(int i = 0; i < procNames.Count; i++)
{
IProcedure objProc = (IProcedure)database.Procedures[procNames[i]];
IResultColumn objColumn;
output.writeln(string.Format(\"Proc: {0}\",objProc.Name));
for(int j = 0; j < objProc.ResultColumns.Count; j++)
{
objColumn = objProc.ResultColumns[j];
output.writeln(string.Format(\"{0}, {1}, {2}\", objColumn.Name,objColumn.Alias,objColumn.DataTypeName));
}
}
while this code does work
- Code: Select all
ArrayList procNames = (ArrayList)input[\"lstProcs\"];
string databaseName = (string)input[\"cmbDatabase\"];
IDatabase database = MyMeta.Databases[databaseName];
// Loop through the procs the user selected and generate the business entities
for(int i = 0; i < procNames.Count; i++)
{
IProcedure objProc = (IProcedure)database.Procedures[procNames[i]];
output.writeln(string.Format(\"Proc: {0}\",objProc.Name));
foreach(object obj in objProc.ResultColumns)
{
IResultColumn objColumn = (IResultColumn)obj;
output.writeln(string.Format(\"{0}, {1}, {2}\", objColumn.Name,objColumn.Alias,objColumn.DataTypeName));
}
}
Also, how do you deal with a SP that returns more than 1 result set?
