Private DataTable DataTable;
PRIVATE DATATABLE CREATEDATASOURCE () ?? {??? DataTable DT = New DataTable (); ??? Datacolumn COL;
??? col = new datacolumn (); ??? col.DataType = system.type.gettype ("system.int32"); ??? columnname = "id"; ??? colum.readonly = true; ??? col.autoincrement = true; ??? col.autoincrementseed = 1; ??? col.AutoincrementsTep = 1; ??? dt.columns.add (col);
??? col = new datacolumn (); ??? col.DataType = system.type.gettype ("system.int32"); ??? columnname = "parentID"; ??? col.readonly = false; ??? col.Unique = false; ??? col.defaultValue = int.parse ("0"); ??? Dt.columns.add (col);
??? dt.columns.add ("filetype", typeof (int)); ??? dt.columns.add ("filename", typeof (string)); ??? dt.columns.add ("FileSize" , TypeOf (int)); ??? dt.columns.add ("lastwritetime", typeof (datetime)); ??? Return DT; ??}
Public DataTable getFolder () ?? {??? checkfolder ();
??? // DataTable DT = CreatedataSource (); ??? DataTable = createDataSource (); ??? DirectoryInfo di = new DirectoryInfo (getCurDir ()); ??? getFolder (0, di); ??? DataTable. Acceptchanges (); ??? Return DataTable; ??}
?? Private void getfolder (int parentid, directoryInfo dirinfo) ?? {??? foreach (directoryInfo di in dirinfo.getdirectories ()) ??? {???? DataRow Row; ???? row = datatable.newrow ( ); ???? row ["parentid"] = ParentID; ???? row ["fileetype"] = 0; // DIR ???? row ["filename"] = di.name; ???? Row ["FileSize"] = 0; ???? row ["lastwritetime"] = di.lastwritetime; ???? DataTable.Rows.add (row); ???? int LPID = (int) datatable.rows [DATATABLE.ROWS.COUNT-1] ["ID"]; // Get the last record Id ???? getfolder (LPID, DI); ???} ??}