?
Solved

Delete Row from DataTable (C#)

Posted on 2006-07-08
2
Medium Priority
?
1,147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 17067243
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 2000 total points
ID: 17082218

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

764 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