Mehmet Fatih

Mehmet Fatih

  • 855
  • 939
  • 41.3k

User constraints

Mar 21 2023 5:32 PM

I restricted some menus in the window forms I created with menustrip for users. The restrictions I set manually work just fine. But I want to put and remove the constraints using checkboxes in the form

instead of putting them manually. But my codes cannot pull constraints from database. I am using access database. I will be glad if you help.

if I do like this it works :

if (yetkim == "1")
{
    sabitBilgilerToolStripMenuItem.Enabled = true;
    kitapIslemleriToolStripMenuItem.Enabled=treu;
    üyeIslemleriToolStripMenuItem.Enabled = true;
    kitapAlisVerisiToolStripMenuItem.Enabled = true;
    raporlarToolStripMenuItem.Enabled = true;
    ayarlarToolStripMenuItem.Enabled = true;
    güvenliÇikisToolStripMenuItem.Enabled = true;
}
else
{
    sabitBilgilerToolStripMenuItem.Enabled = false;
    kitapIslemleriToolStripMenuItem.Enabled = false;
    üyeIslemleriToolStripMenuItem.Enabled = false;
    kitapAlisVerisiToolStripMenuItem.Enabled = true;
    raporlarToolStripMenuItem.Enabled = false;
    ayarlarToolStripMenuItem.Enabled = false;
    güvenliÇikisToolStripMenuItem.Enabled = true;
    kitapIslemleriToolStripMenuItem.Enabled = true;

but this doesn't work :

if (yetkim == "1")
{
    sabitBilgilerToolStripMenuItem.Enabled = true;
    kitapIslemleriToolStripMenuItem.Enabled = true;
    üyeIslemleriToolStripMenuItem.Enabled = true;
    kitapAlisVerisiToolStripMenuItem.Enabled = true;
    raporlarToolStripMenuItem.Enabled = true;
    ayarlarToolStripMenuItem.Enabled = true;
    güvenliÇikisToolStripMenuItem.Enabled = true;

}
else
{
    OleDbDataAdapter adap = new OleDbDataAdapter("SELECT akatad FROM altkatagori", conn);
    DataTable tbl = new DataTable();
    adap.Fill(tbl);
}


Answers (3)