Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
good day code project..
i am currently developing a project and i was stock with treelistview of devexpress what i want is that i have a 3 tables namely Category, Product, Size in my database..
and i want a view like this in my database to represent as my inventory form.

* represent as node 1 COVERALL(CATEGORY)
- represent as node 2 APLAYA(PRODUCT)
> represents as node 3 SMALL ETC (SIZES)
------------------------------------------------------------------------------------------------
| Product Category | | |
------------------------------------------------------------------------------------------------
* COVERALL | | |
------------------------------------------------------------------------------------------------
- APLAYA | PRODUCTS -IN | PRODUCTS OUT | TOTAL
------------------------------------------------------------------------------------------------
>SMALL | 120 | 50 | 70
------------------------------------------------------------------------------------------------
>LARGE | 130 | 40 | 90
------------------------------------------------------------------------------------------------
>MEDIUM | 140 | 40 | 140
------------------------------------------------------------------------------------------------
>EXTRALARGE | 180 | 30 | 150
------------------------------------------------------------------------------------------------


that's why i want to do with my application through the treelistview tool..
please help me .. i really nid it..

thank you very much
Posted
Comments
[no name] 10-Mar-13 10:27am    
" i want a view like this in my database", okay so? Create a view in your database then.
"that's why i want to do with my application", that makes no sense at all.
Please post the code that you are having trouble with and clearly describe what the problem is. So far, you have not asked any kind of a question nor have you described any kind of a problem.
John Mark Olesco 10-Mar-13 12:10pm    
As of the moment this is the code that i have..
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlCommand cmd = new SqlCommand("SELECT C.PRODUCT_CATEGORY, P.PRODUCT_NAME FROM CATEGORY C INNER JOIN PRODUCT P ON C.PRODUCT_CATEGORY_ID = P.PRODUCT_CATEGORY_ID", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "CATEGORY, PRODUCT");
TreeListNode parentnode = treeList1.Nodes[0];
treeList1.DataSource = ds.Tables["CATEGORY, PRODUCT"];
John Mark Olesco 11-Mar-13 8:47am    
this is the code

String value = "";
String value1 = "";
String newvalues = "";
DataTable tbl = new DataTable();
tbl.Columns.Add("ID", typeof(String));
tbl.Columns.Add("PARENTID", typeof(String));
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlCommand cmd = new SqlCommand("SELECT C.PRODUCT_CATEGORY AS CATEGORY, P.PRODUCT_NAME AS BRANDNAME FROM CATEGORY C INNER JOIN PRODUCT P ON C.PRODUCT_CATEGORY_ID = P.PRODUCT_CATEGORY_ID", con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
value = reader["CATEGORY"].ToString();
value1 = reader["BRANDNAME"].ToString();
newvalues = value;
//if (value !=newvalues)
//{
a++;
tbl.Rows.Add(new object[] { value, a });
tbl.Rows.Add(new object[] { value1, a });
//}
//else if(value.Equals(newvalues))
//{
// MessageBox.Show("Value Exist"+ value);
//}
}
return tbl;
con.Close();

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