Jump to content

Datatable'dan String Alma Yardım


muratboy31
 Share

Recommended Posts

Arkadaşlar merhaba,

 

aşağıdaki kodun şu kısmında if (bool.Parse(Satir["Ac"].ToStri­ng()) == 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"].ToStri­ng()) == 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"].ToStri­ng()) == false)    satırı silip tekrardan yazdım düzeldi, bende anlamadım...


if (bool.Parse(Satir["Ac"].ToStri­ng()) == false) tekrardan yazınca düzeldi !!!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...