mercredi 2 décembre 2015

Invalid column name Menu_mkey

While debugging through the code, I am getting error as

Invalid column name Menu_mkey

Here is the code for that

string strsqlflag = "select count(*) from WMS_User_Rights where User_Id='" + Hid_Selected_user.Value + "'  and delete_flag='N' ";


        if (Dt.Rows[e.Row.RowIndex]["child_menu_mkey"].ToString() == "0")
        {
            strsqlflag += " and  MENU_MKEY = '" + Dt.Rows[e.Row.RowIndex]["MKEY"] + "'";
        }
        else
        {
            strsqlflag += " and  MENU_MKEY = '" + Dt.Rows[e.Row.RowIndex]["child_menu_mkey"] + "'";
        }

which generated the below query

select count(*) from WMS_User_Rights where User_Id='1'  and delete_flag='N'  and  MENU_MKEY = '1'

Now, here I want Menu_mkey too, but the issue is that it is coming from another table which is from table WMS_menu_rights

How to achieve this ?

on a side note:- I am using SQL-server 2005

Aucun commentaire:

Enregistrer un commentaire