sql server 2005 and IProcedure.ResultColumns

Any template questions or comments or suggestions

sql server 2005 and IProcedure.ResultColumns

Postby ormico on Mon Mar 26, 2007 2:32 pm

I'm new to MyGeneration so I might be doing something wrong, but I cannot access this property through the indexor.

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?
ormico
Corporal
 
Posts: 21
Joined: Mon Mar 26, 2007 2:16 pm

Postby justin.greenwood on Mon Nov 26, 2007 2:51 am

I think I just fixed this. you can try it in the release candidate version of mygeneration 1.3 (coming very soon).
User avatar
justin.greenwood
Site Admin
 
Posts: 441
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby ormico on Fri Dec 07, 2007 10:16 pm

is this the version to test?
MyGeneration Code Generator 1.3.0.1 2007-12-06
ormico
Corporal
 
Posts: 21
Joined: Mon Mar 26, 2007 2:16 pm


Return to General Template Questions/Comments

Who is online

Users browsing this forum: No registered users and 2 guests

cron