| Bug #64008 | 2 SQL statements no changes getting through | ||
|---|---|---|---|
| Submitted: | 12 Jan 2012 10:32 | Modified: | 18 Jan 2012 7:27 |
| Reporter: | dave lilley | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 6.3.6 & 6.3.8 | OS: | Windows |
| Assigned to: | Bogdan Degtyariov | CPU Architecture: | Any |
| Tags: | TableAdapters | ||
[12 Jan 2012 10:32]
dave lilley
[12 Jan 2012 10:38]
Valeriy Kravchuk
Please, send exact CREATE TABLE statements for all tables involved, to begin with...
[15 Jan 2012 9:39]
dave lilley
sample of the type of code I have used
Attachment: tableadapter1.zip (application/zip, text), 140.62 KiB.
[15 Jan 2012 9:50]
dave lilley
please note the underlying DB is Mysql 5.1 and the Table schemea is as below...
id primary auto increment
name varchar(45)
add_nos int
street_name varchar(45)
suburb varchar(45)
city varcar(45)
With the sample code posted before I hope you can expose ...
A) What I am doing wrong
b) what is missing in the documentation
ALso note their was a toolstrip component put on my form I noticed for the entry of my @PARAM1.
I deleted this as I cannot see WHY I'd want to use it.
In my program i use the tableadapter.Update(dataset,"this is the param1 value");
dave.
[17 Jan 2012 11:41]
Bogdan Degtyariov
Hi Dave, Thanks for sending the test project. I was able to repeat the problem using MySQL Connector/NET 6.3.8 and 6.4.4.
[17 Jan 2012 13:24]
Bogdan Degtyariov
I have done some more debugging and found a weird thing:
after modifying the data row I see changes inside the dataset, but the RowState remains "Unchanged":
((System.Data.DataRow)(this.custData.custnames[0])).RowState is "Unchanged"
That is why base DbDataAdapter.Update() method does nothing, although it is actually called from MySQL code (dataadapter.cs: lines 168-191):
protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping)
{
List<MySqlConnection> connectionsOpened = new List<MySqlConnection>();
try
{
// Open connections for insert/update/update commands, if
// connections are closed.
foreach(DataRow row in dataRows)
{
OpenConnectionIfClosed(row.RowState, connectionsOpened);
}
int ret = base.Update(dataRows, tableMapping);
return ret;
}
finally
{
foreach(MySqlConnection c in connectionsOpened)
c.Close();
}
}
[17 Jan 2012 13:43]
Bogdan Degtyariov
Looks like the problem in the DataSet or DataRow NET framework classes. Otherwise I don't know why the row might have "Unchanged" state after the data was actually edited. I am open to further discussions. Meanwhile setting the status "Not a bug".
[18 Jan 2012 7:27]
dave lilley
Quote... Looks like the problem in the DataSet or DataRow NET framework classes. Otherwise I don't know why the row might have "Unchanged" state after the data was actually edited. I am open to further discussions. Meanwhile setting the status "Not a bug". End of qoute... Fine this isn't a bug (but take mild exception to the above statement when their is nothing to say what I've done is wrong in connector documentation I have read) but a usage issue. Can you correct my sample app so it works as expected? (I haven't in 3/4 weeks of googling various terms using mysql, conector 6.3.8 or 6.3.6, tableadapter mutliple fill/gets in searches). I am happy to write about this (even put something up in the forums of C# .net connectors here). Note... When i created the parameterised query i saw an auto generated striptool component put in my project. Because I deleted it did I create this condition? Even though I seem a bit negative above I have wasted time trying to get the update query to work (I know I'm not the best programmer but I do endevour to search the internet for ideas on how to solve my problems before I post something forums) I appreciate you're time on this matter greatly. regards, Dave. Can you suggest other resources I could go to for help if you are unable to correct my program to work as expected?
