473,671 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem when using DataTable.Row[x].Delete() - "no row at pos 5"

I have a really stupid problem I'm hoping to get help with.

The problem occurs if I delete rows from a dynamically built datatable.

ie:
CreateDataTable (); // creates the structure of the table
myTable.Rows[4].Delete();

now if I put that datatable back in a dataset and bind that ds to a grid, I
get the error "there is no row at position 216"

why oh why? Please help!
Jul 21 '05 #1
2 2259
Try calling dataset.AcceptC hanges() before binding it to the grid

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

aiKeith wrote:
I have a really stupid problem I'm hoping to get help with.

The problem occurs if I delete rows from a dynamically built datatable.

ie:
CreateDataTable (); // creates the structure of the table
myTable.Rows[4].Delete();

now if I put that datatable back in a dataset and bind that ds to a grid, I
get the error "there is no row at position 216"

why oh why? Please help!

Jul 21 '05 #2
AiKeith,

I do not understand this row
now if I put that datatable back in a dataset


Do you first remove it from the dataset?

Do not forget that this add a new table
ds.tables.add(m ytable)
This does not create a new table
dt = ds.tables(mytab le) however just set a reference

I am curious what you mean with that sentence?

Cor
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2871
by: Chris Lasher | last post by:
Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found. This is undesirable in cases where I would like to circumvent execution of code meant to parse out data from my finditer() object. I know that if I place a finditer() object in an iterative for loop, the loop will not execute, but is there some...
0
2040
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since the thread is over a month old, I decided to start a new one with my response. Please see my comments inline.
11
9493
by: suma | last post by:
Hello, I want to delete duplicate rows in a table when no primary key is defined. For eg: If we have table1 with data as below, Suma 23 100 Suma 23 100 I want to delete a row from this table and retain only one row.
8
2101
by: Brad Wood | last post by:
When I do this: foreach( Button btn in myForm.Controls ) An exception is raised when no buttons exist. I would simply expect execution to continue after the foreach loop (just as would be the case with a regular for loop when the second expression is false when the loop begins). Is there an explanation for this?
2
5206
by: Brent Burkart | last post by:
Below is the error I am receiving. I have checked SQL Profiler and it is receiving the correct query which runs fine in Query Analyzer. Any ideas? Server Error in '/lockinsheet' Application. ---------------------------------------------------------------------------- ---- Invalid attempt to read when no data is present. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
4
12359
by: Dave | last post by:
I'm using a datareader to get data from an sql table. The line that gives the error is as follow, dtrReceivers.ToString() which gives the error, Invalid attempt to read when no data is present which is correct. The line works when data is in the row. But shouldn't the
4
3469
by: MarkusR | last post by:
If I run the stored proc in the Query Analyzer this works and I get the expected result set back. However when I run it in my application I get a results set of one row but when I try to access the values I get "Invalid attempt to read when no data is present". private void GetLotIDPriorityFromLot(string aLotDesc, out int aLotID, out DateTime aPriorityDate) { SqlConnection Conn; SqlDataReader reader = null;
3
6522
by: divsTiw | last post by:
I want to populate combo box with data from OracleDataReader , but "Invalid attempt to read when no data is present." is thrown. there are two rows returned , then too why such error. plzzz share ur knowledge to help me out with this probs. my code is as below,
2
1756
by: Naty | last post by:
please can anybody help me? i'm trying to retrieve data from a db with visual studio 2005 and sql server 2000 in a web application, and the error "Invalid attempt to read when no data is present" keeps showing and i don't know why...i executed my stored procedure in the query analyzer and it's ok, i'm using the sentence "mydatareader.Read()" and it's working well....please, does anybody know what can i do?
5
2439
Dököll
by: Dököll | last post by:
Hey Fans! Perhaps you can help me... I am using MS Access 2003. I have tried a number of things to get rid of the text #Error from appearing on form fields when no data present. Tried the NZ function, also tried the IIF function, told it to give me zero if no data found, so far it seems to lead to nowhere land. What are your thoughts? Hopefully it's not very simple and I missed the boat, hee hee... Thanks for your help!
0
8478
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8397
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6230
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2813
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.