Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi!
I am sorry for my poor english!
i have this imageDB
database and i want generate this format
XML
<li>main</li>
<ul>
<li>sub</li>
<li>sub</li>
</ul>


by c# and asp.net from this table please help me it's urgent.
Thanks.
Posted
Updated 14-Jul-12 10:27am
v2
Comments
Abdul Quader Mamun 14-Jul-12 22:05pm    
you need to little bit work with the code.

1 solution

C#
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("connectionStringHere");
con.Open(); 

System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;

//you need to customize sp as you want
cmd.CommandText = "sp_Here";

System.Data.SqlClient.SqlDataReader reader;
reader = cmd.ExecuteReader();

System.Text.StringBuilder sb=new System.Text.StringBuilder() 

sb.AppenedLine("<ul>");
while(reader.Read())
{
//you need to customize this as you want
sb.AppenedFormat("<li>{0}</li>"  reader.GetString(0));
}
sb.AppenedLine("</ul>");


Try with this code.

Thanks,
Mamun
 
Share this answer
 
Comments
Behnam Mohammadi 15-Jul-12 14:54pm    
Thank you very much.
But I want the menu to be made. The following sub-menu to the menu each time to be unlimited.
Such as content management systems.
If someone put the video in my top tips to help me get much thanks.
Very essential and urgent need
Thank you very much.
Abdul Quader Mamun 15-Jul-12 15:18pm    
http://www.codeproject.com/Articles/124969/Parent-Child-Hierarchical-Relational-Treeview-User

here is an example of parent-child or upto infinity. try with this
Behnam Mohammadi 24-Jul-12 11:46am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900