Bug #27410 Update doesn't insert newrow
Submitted: 23 Mar 2007 20:50 Modified: 11 Jun 2007 20:40
Reporter: B. F. Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.1.0 OS:Windows (win xp sp2)
Assigned to: CPU Architecture:Any
Tags: MySqlDataAdapter, UPDATE

[23 Mar 2007 20:50] B. F.
Description:
Working with .net connector 5.0.6, visual studio plugin 1.1.2 alpha. I just generated a dataset based on my MySQL database in Visual Studio 2005, but the tableadapters are not configured correctly I suppose. When I call "Update" on a tableadapter, using the newly added row as parameter (or the datatable to which I added the new row), it only inserts empty values in my database. So rows with rowstate "added" are empty in the database using the Update command. The Insert command of the tableadapter doesn't work either, it inserts empty rows in my database as well.

How to repeat:
DataTable table = new DataTable();
DataRow newRow = table.NewRow();

newRow.value1 = bla;
newRow.value2 = bla;

table.AddRow(newRow);

TableAdapter testAdapter = new TableAdapter();
testAdapter.Update(newRow); //doesn't work!
testAdapter.Update(table); //doesn't work!
testAdapter.Insert(bla, bla); //doesn't work!

Suggested fix:
?
[3 Apr 2007 7:22] Tonci Grgin
Hi and thanks for your report.
Can you please attach relevant part of general query log from server (from when you connect in server explorer up until last update/insert command that fails)?
What is the MySQL server version? NET FW version?
[3 Apr 2007 12:22] B. F.
Hi Tonci,

It is simply a matter of the plugin not generating update statements and incorrect insert statements when dragging a table from the server explorer to my dataset. So calling the insert or update function simply doesn't work because the query is not there (or incorrect) and the parameter collection are missing.

The mysql server version is 5.0.37, and I don't have logs over here for you (maybe later in the week). I think it's very easy to reproduce the problem. Just drag a table from the server explorer to a dataset (VS 2005), and you'll see that no update command is generated and an incorrect insert command is generated. My project is stuck now for 2 weeks because on this problem, and it would be an awful lot of work to create those statements by hand. I just would love to see those statements getting generated by the plugin, as the default behaviour should be in my opinion. Thank you for your effort!
[6 Apr 2007 11:22] B. F.
Hi Tonci,

Is this an issue that you're going to solve some day, or do I have to find another method to create my database layer? I'm losing too much time at the moment waiting for a solution, so I want to decide whether I choose for another solution soon... Thank you in advance!
[6 Apr 2007 11:57] Tonci Grgin
Hi and thanks for your report. I appologize for the delay.

I am examining this report together with Bug#27642 and the work, from my side, will be done by the end of this week.
[6 Apr 2007 18:23] Jay Wren
I'm having similar issues with the connector. I'd be willing to look into the issue if the plugin were open source. The VisualStudio Plugin page says that source is coming soon?
[7 Apr 2007 19:17] Tonci Grgin
> "It is simply a matter of the plugin not generating update statements and incorrect insert statements when dragging a table from the server explorer to my dataset. So calling the insert or update function simply doesn't work because
the query is not there (or incorrect) and the parameter collection are missing."

Yes, the problem seems to be that Plugin doesn't respect "GenerateDBDirectMethods" in wizard so actually statements are missing even though they are checked in final stage... One needs to set "GenerateDBDirectMethods" to True manually in object explorer. Of course, there are no params when there's no command(s)...
After setting "GenerateDBDirectMethods" to True manually I do have InsertCommand in place but parameter(s) are not added automatically.
Update and delete commands are not added.

Environment:
 - MySQL server 5.0.38BK on WinXP Pro SP2 localhost
 - c/NET latest sources, Plugin 1.1.2 GA, NET fw 2.0
[10 Apr 2007 18:19] B. F.
Hi Tonci,

So should I use your workaround as described above or is it still getting fixed soon? Thank you!
[11 Apr 2007 6:45] Tonci Grgin
Hi.

I still can't recreate all of the problems I have seen during testing in a single, repeatable test case but, since report is marked as "Verified", it will get some additional attention soon. I can't say when, though.
[2 May 2007 3:41] Reggie Burnett
Moving this to the Connector/Net category since we are no longer going to accept bug reports into this category.
[11 Jun 2007 20:40] Reggie Burnett
This is essentially a duplicate problem to bug # 26347 which has just been fixed in 5.1.2.