asp.net - Using DataTables and storing values -


i new c#.net. have method pass parameters in loop , each parameter there different rows returned . rows (which have data of different data types) database. want store data rows somewhere arraylist. , use furthue peocessing.

plz tell me how this. enter code here

/*ideally get_childandparentinfo(int pointid) function returns array list how deal array list containing datarows different data types */

public static arraylist get_childandparentinfo(int pointid)      {         string sp_name = "usp_get_parents";         sqlparameter[] parameters = new sqlparameter[1];         parameters[0] = new sqlparameter("@intpointid", dbtype.int32);         datatable dtchildinfo = new datatable();         arraylist childnparents = new arraylist();         arraylist collect = new arraylist();          int = 0;           parameters[0].value = pointid;               dtchildinfo = datalayer.getdata1(sp_name, parameters);              //  (i = 0; < dtchildinfo.rows.count; i++)             //  {             //      arraylist temp = new arraylist();             //      (int j = 0; j < dtchildinfo.columns.count; j++)             //      {             //          temp.add(dtchildinfo.rows[0][j]);             //      }             //      //collect[i] = temp;             //      collect.insert(i, temp);             //      temp.clear();             //}                 //printvalues(collect);         return (collect);     }     public static arraylist send_sms() **///entry point function**     {          arraylist points = new arraylist();         datatable pathinfo = new datatable();         arraylist parentinfo = new arraylist();         pathinfo = get_activepath();          points = getpoints(pathinfo);**//returns 6,3**         (int = 0; < points.count; i++)         {             //parentinfo = get_childandparentinfo();              parentinfo = get_childandparentinfo(convert.toint32(points[i]));             printvalues(parentinfo);         }           return parentinfo;      } 

it looks you're trying return arraylist of arraylists. better return generic list instead of arraylist.

arraylist collect = new arraylist(); 

should be

list<customclass> collect = new list<customclass>(); 

custom class:

class customclass {     private arraylist _childdata;     public void insert(arraylist data)     {         _childdata.add(data);     }     public arraylist childdata {         { return _childdata; }     } } 

(please forgive bad c# syntax. i'm vb.net guy.)


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -