Solved

Delete Row from DataTable (C#)

Posted on 2006-07-08
2
1,113 Views
Last Modified: 2007-12-19
Hi,
 I need a help tp write a funtion that gets a parametrs number of Row as R and DataTable as dt
The Function return a new table without the Row number R.

Thanks
0
Comment
Question by:madmare
2 Comments
 
LVL 6

Expert Comment

by:MuhammadAdil
Comment Utility
Hello Dear

Pass RowIndex and DataTable it return DataTable without That row

public DataTable DelRow(int RowIndex, DataTable dt)
        {
            dt.Rows[RowIndex].Delete();
            return dt;
        }
0
 
LVL 1

Accepted Solution

by:
flashaoy earned 500 total points
Comment Utility

DataTable Delete(DataTable table,int index )
{
            table.Rows[index ].Delete();
            return table;
}
DataTable  table=Delete(DataTable1 ,2);
or  u can use this

this peter >>>>
void Delete(ref DataTable table,int index )
{
            table.Rows[index ].Delete();
}
-----------
Delete(ref DataTable1 ,2);

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now