I have 2 tables in my SQL Server database, using Visual Studio 2013:
Category
- Id
- Name
Product
- Id
- Name
- CategoryId
I have a Product Page built in ASP.NET (webforms) in which I can Create, Edit or Delete Products.
I made a connection (foreign key) between the 2 tables.
I want to display my products and instead of having the Category as a number (Id) I want to have it`s name.
How should I do it?
My knowledge in SQL is pretty basic.
This is how I`m displaying the code, using a DataList:
string SQL = "SELECT * FROM Products;";
SqlCommand cmd = new SqlCommand(SQL, conn);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds);
dlProducts.DataSource = ds;
dlProducts.DataBind();
Thank you a lot!!