I am trying to implement when admin delete a particular category then service posted by service provider under that category should not be shown
It is implemented successfully but when admin delete any item of subcategory then service posted under that subbcategory should not be shown to the user.
how to do so?
public partial class SS_main_Afterlogin : System.Web.UI.Page
{
SqlConnection mycon = new SqlConnection(ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ToString());
SqlCommand cmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string constr = ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("Select * from SP_Afterlogin2 where Category IN (select Category from Category_tbl2)", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
}
Above code is when admin delete any particular item from category
My tables is like this:
CREATE TABLE [dbo].[Sub_category] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[Sub_category] VARCHAR (50) NULL,
[CId] INT NOT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
CREATE TABLE [dbo].[Category_tbl2] (
[CId] INT IDENTITY (1, 1) NOT NULL,
[Category] VARCHAR (50) NULL,
PRIMARY KEY CLUSTERED ([CId] ASC)
);