How to delete a row in the table

enrc66

Client
Регистрация
12.10.2013
Сообщения
89
Благодарностей
8
Баллы
8
Код:
int c=project.Tables["Table3"].RowCount;
            for(int i=0;i<project.Tables["Table4"].RowCount;i++)
            {
                project.Tables["Table3"].AddRow(project.Tables["Table4"].GetRow(i));
            }
            c=project.Tables["Table3"].RowCount;
                while(project.Tables["Table3"].RowCount>0)
            {
                project.Tables["Table3"].DeleteRow(0);
            }
debug in codecreate ,alert the error:
Failed to delete a row from the table Table3

how could resolve the problem about deleting a row of the table?
 

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
try to delete rows from last to first
 
  • Спасибо
Реакции: Nick

enrc66

Client
Регистрация
12.10.2013
Сообщения
89
Благодарностей
8
Баллы
8

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
for(int j=t1_rows-1;j>=0;j--)
 

enrc66

Client
Регистрация
12.10.2013
Сообщения
89
Благодарностей
8
Баллы
8

enrc66

Client
Регистрация
12.10.2013
Сообщения
89
Благодарностей
8
Баллы
8
Код:
var t1=project.Tables["Table1"];
                    var t2=project.Tables["Table2"];
                    int t2_rows=t2.RowCount;
                    int t1_rows=t1.RowCount;
                    string t2_content="";
                    string t1_content="";
                    lock(Global.ZennoExtensions.SyncObjects.TableSyncer)
                    {
                        for(int i=0;i<t2_rows;i++)
                        {
                            t2_content=t2.GetCell("A",i);
                            for(int j=t1_rows-1;j>=0;j--)
                            {
                                t1_content=t1.GetCell("A",j);
                                if(t1_content.Contains(t2_content))
                                {
                                    t1.DeleteRow(j);       
                                   
                                }
                            }
                        }
                    }
this is the code
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)