473,382 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

MySqlCommandBuilder not updating the removed rows.

4
Hi, i have writen the following code:

Expand|Select|Wrap|Line Numbers
  1. string mySqlCommandString = "SELECT * FROM fxs_prueba";
  2. MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter();
  3. mySqlDataAdapter.SelectCommand = new MySqlCommand(mySqlCommandString, mySqlConnection);
  4. MySqlCommandBuilder mySqlCommandBuilder = new MySqlCommandBuilder(mySqlDataAdapter);
  5.  
  6. mySqlConnection.Open();
  7.  
  8. DataTable myDataTable = new DataTable("Test");
  9. mySqlDataAdapter.Fill(myDataTable);
  10.  
  11. myDataTable.Rows.RemoveAt(2);
  12.  
  13. int rowsAffected = mySqlDataAdapter.Update(myDataTable);
  14.  
  15. mySqlConnection.Close();
  16.  
But the database table is not updated. The row is still there.
It works perfect when i insert a row or modifie a row and then call the Update method.
I do not get any exceptions, it just is not working.
I use the MySQL Connector Net 5.0.6
and the table uses the MyISAM engine
What am i doing wrong?

Thanks in Advance
Felix
Jul 11 '07 #1
3 1294
nfxs
4
Hellooo!!
Anyone?
(is it now 20 chars long?)
Jul 25 '07 #2
r035198x
13,262 8TB
Hellooo!!
Anyone?
(is it now 20 chars long?)
Aren,t you supposed to call some refresh method like AcceptChanges or something fo the changes to show?
P.S I think this is best handled in the .NET forum so I'll copy it there.
Jul 25 '07 #3
RoninZA
78
This is not the ideal way to be deleting rows out of a table, but if you insist on using a data adapter, you need to set the delete command peoperty, and delete the missing rows one for one...

Hope it helps!
Jul 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
3
by: | last post by:
I am trying to Delete records from Fox Pro Free Tables (.DBF) using C#. I am able to insert and view data with no problems but when I try to delete - no luck. It appears that I need to run a...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
1
by: gaDev | last post by:
1) I build a Html Table dynamically (Header Row, and then 2 rows with data All 2 rows have 2 cells: cell(0) contains a delete button (ASP Button), cell(1) contains a HTML Text box 2) On Form Load...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
2
by: UKuser | last post by:
Hi Folks, I havent used javascript in ages, and am not the worlds guru, but I'm playing with ajax linking to my database and an updating area. I have an area named display for example which...
2
by: nfxs | last post by:
Hi, i have writen the following code: string mySqlCommandString = "SELECT * FROM fxs_prueba"; MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(); mySqlDataAdapter.SelectCommand = new...
0
by: deathprincess | last post by:
Hi Guyz, Need some help in updating my data grid view. I used the Rows removed and selection changed events. i have a code on the selection changed events and it worked well but the code on...
2
by: raulbolanos | last post by:
Hi Pr0's, I have a problem trying to implement the same example from this link: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx But instead of Sql I use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.