muratboy31 Posted June 3, 2015 Share Posted June 3, 2015 Arkadaşlar merhaba, aşağıdaki kodun şu kısmında if (bool.Parse(Satir["Ac"].ToString()) == false) hata alıyorum neden olabilir acaba ? public void Yetki() { SqlConnection mycon = new SqlConnection(); SqlCommand mycommand = new SqlCommand(); SqlDataAdapter adp = new SqlDataAdapter(mycommand); try { mycon.ConnectionString = Connect; mycon.Open(); mycommand.Connection = mycon; mycommand.CommandText = "sp_Yetki_Listele"; mycommand.CommandType = CommandType.StoredProcedure; mycommand.Parameters.Add("@username", SqlDbType.NVarChar, 20); mycommand.Parameters["@username"].Value = "Murat"; DataTable dtable = new DataTable(); adp.Fill(dtable); foreach (DataRow Satir in dtable.Rows) { if (bool.Parse(Satir["Ac"].ToString()) == false) { foreach (DevExpress.XtraNavBar.NavBarGroup Grup in navBarControl1.Groups) { if (Grup.Caption == Satir["Form_Adi"].ToString()) Grup.Visible = false; } foreach (DevExpress.XtraNavBar.NavBarItem subitem in navBarControl1.Items) { if (subitem.Caption == Satir["Form_Adi"].ToString()) subitem.Visible = false; } } } } catch (Exception e) { MessageBox.Show(Convert.ToString(e)); } finally { mycon.Close(); } } if (bool.Parse(Satir["Ac"].ToString()) == false) satırı silip tekrardan yazdım düzeldi, bende anlamadım... if (bool.Parse(Satir["Ac"].ToString()) == false) tekrardan yazınca düzeldi !!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.