Question Deleted row bindingsource error ?

ebrahim

New member
Joined
May 30, 2015
Messages
1
Programming Experience
1-3
Hi friends.
I once sent a table to store the database.
To add no problem.
But when I clear the table a few lines or 1 line gives the following error message
eek.gif
:

Deleted row information can not be accessed through the row.

UI Layer :
C#:
try
            {
                blCls._Kind = 3;
                gridViewCarName.FocusedRowHandle = 0;
                bsCarName.DataSource = gridControlCarName.DataSource;
                blCls._CarList = bsCarName.DataSource as DataTable;
                str = blCls.dalAddList();
                if (str != "1")
                {
                    ShowMessage.Show(str, "خطا", ShowMessage.PersionMessageBoxButton.Ok,ShowMessage.PersionMessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowMessage.Show(ex.Message, "خطا", ShowMessage.PersionMessageBoxButton.Ok, ShowMessage.PersionMessageBoxIcon.Error);
                return;
            }
BL Layer :
C#:
public string dalAddList()
       {
           dalClsBasicInformatioList._Kind = kind;
           if(kind==1)
               dalClsBasicInformatioList._CategoryList = categoryList;
           else if (kind == 2)
               dalClsBasicInformatioList._UnitList = unitList;
           else if (kind == 3)
           dalClsBasicInformatioList._CarList = carList;
           else if (kind == 4)
           dalClsBasicInformatioList._ServicsCardNameList = servicsCardNameList;
            
           return dalClsBasicInformatioList.dalAddList();
       }

DAL Layer :
C#:
public string dalAddList()
        {
            con.Connect();
            SqlCommand cmd = new SqlCommand("Utility.Merge_List", con.Conn);
            cmd.CommandType = CommandType.StoredProcedure;
            //==================================================  =========
            cmd.Parameters.Add("@Kind", SqlDbType.TinyInt).Value = kind;
            if (kind == 1)  
                cmd.Parameters.Add("@Category", SqlDbType.Structured).Value = categoryList;
            else if (kind == 2)
                cmd.Parameters.Add("@Unit", SqlDbType.Structured).Value = unitList;
            else if (kind == 3)
                cmd.Parameters.Add("@CarList", SqlDbType.Structured).Value = carList;
            else if (kind == 4)
                cmd.Parameters.Add("@NameServiceCard", SqlDbType.Structured).Value = servicsCardNameList;
            //==================================================  =========
            cmd.ExecuteNonQuery();
            con.Disconnect();
            return "1";
        }
 
Back
Top Bottom