Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is Someone aware of this Error? Pin
Dave Kreskowiak7-Jul-05 8:02
mveDave Kreskowiak7-Jul-05 8:02 
GeneralRe: Is Someone aware of this Error? Pin
just4ulove77-Jul-05 8:06
just4ulove77-Jul-05 8:06 
GeneralRe: Is Someone aware of this Error? Pin
Dave Kreskowiak7-Jul-05 9:45
mveDave Kreskowiak7-Jul-05 9:45 
AnswerRe: Is Someone aware of this Error? Pin
Guffa7-Jul-05 6:25
Guffa7-Jul-05 6:25 
GeneralDataTable Tree Question Pin
Markus1980Wien7-Jul-05 4:46
Markus1980Wien7-Jul-05 4:46 
GeneralRe: DataTable Tree Question Pin
Alomgir Miah7-Jul-05 5:10
Alomgir Miah7-Jul-05 5:10 
GeneralRe: DataTable Tree Question Pin
Markus1980Wien7-Jul-05 7:23
Markus1980Wien7-Jul-05 7:23 
GeneralRe: DataTable Tree Question Pin
Alomgir Miah7-Jul-05 7:55
Alomgir Miah7-Jul-05 7:55 
Please use the query

SELECT distinct parentid FROM table parentid is not null


The C# implementation will be something similar to the following. The code is not tested but the concept is there. Hope this helps.


DataSet ds = new DataSet();

SqlDataAdapter myda = new SqlDataAdapter("TreeView", "server=localhost;database=TreeDb;uid=sa;pwd=;");

myda.SelectCommand.CommandType = CommandType.StoredProcedure;

myda.Fill(ds, "Table");

SortedList slist = new SortedList();


DataView dv = new DataView();

dv.Table = ds.Tables["table"];
dv.AllowDelete = true;
dv.AllowEdit = true;
dv.AllowNew = true;
dv.RowFilter = "parentid <> null";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
dv.Sort = "parentid DESC";


IEnumerator iterator = dv.GetEnumerator();
DataRowView drv;
System.Int32 i= 0;
while(iterator.MoveNext())
{
drv = (DataRowView)iterator.Current;
if (! slist.ContainsValue(dr["parentid"]))
{
slist.Add(dr["parentid"].ToString (), dr["table"].ToString ());
}

i++;
}


DataList1.DataSource = slist.GetValueList();

DataList1.DataBind();


Cheers,
Alomgir Miah
GeneralWatching for a file Pin
Andy *M*7-Jul-05 3:50
Andy *M*7-Jul-05 3:50 
GeneralRe: Watching for a file Pin
Guffa7-Jul-05 3:55
Guffa7-Jul-05 3:55 
GeneralRe: Watching for a file Pin
Andy *M*7-Jul-05 4:05
Andy *M*7-Jul-05 4:05 
GeneralRe: Watching for a file Pin
squawk7-Jul-05 16:42
squawk7-Jul-05 16:42 
QuestionHow to detect if Themes are enabled in .NET 2.0? Pin
Carl Mercier7-Jul-05 3:21
Carl Mercier7-Jul-05 3:21 
AnswerRe: How to detect if Themes are enabled in .NET 2.0? Pin
WillemM7-Jul-05 3:46
WillemM7-Jul-05 3:46 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
Anonymous7-Jul-05 6:59
Anonymous7-Jul-05 6:59 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
Carl Mercier7-Jul-05 7:03
Carl Mercier7-Jul-05 7:03 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
WillemM7-Jul-05 7:40
WillemM7-Jul-05 7:40 
AnswerRe: How to detect if Themes are enabled in .NET 2.0? Pin
Daniel Grunwald7-Jul-05 4:36
Daniel Grunwald7-Jul-05 4:36 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
Carl Mercier7-Jul-05 7:08
Carl Mercier7-Jul-05 7:08 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
Andy Moore7-Jul-05 7:28
Andy Moore7-Jul-05 7:28 
GeneralRe: How to detect if Themes are enabled in .NET 2.0? Pin
Carl Mercier7-Jul-05 7:37
Carl Mercier7-Jul-05 7:37 
Generaluser-specific registry entries Pin
Member 4558387-Jul-05 3:17
Member 4558387-Jul-05 3:17 
GeneralGenerating an activation code to enable use of an application Pin
AfzalHassen7-Jul-05 1:57
AfzalHassen7-Jul-05 1:57 
GeneralRe: Generating an activation code to enable use of an application Pin
Christian Graus7-Jul-05 2:07
protectorChristian Graus7-Jul-05 2:07 
GeneralRe: Generating an activation code to enable use of an application Pin
Afzal Hassen7-Jul-05 2:43
sussAfzal Hassen7-Jul-05 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.