Wednesday, March 21, 2012

Got the same problem

Hello.
I use VS2005 and I was trying to make a little program able to connect to a MySQL 5.0.18 database through MyODBC 3.51.12. I can connect to the database and I can load a table in the Datagridview control, but I can't update the table: the wizard didn't generate the Update method. Even if I configure again the tableAdapter, the wizard generates only:
SELECT statement
table mappings
Fill method
Get method
The table is a very simple table: it has 3 columns and the first is a primary key.

If I create an identical table using Access database and make a program that connects through ODBC, I don't have the problem: the wizard generates also the UPDATE, INSERT and DELETE statements.

Where is the difference? What is the problem?

Thankyou so much for the help

Anthony R.

The MyODBC Driver could not generate the UPDATE command. But the MySQLDirect .NET Data Provider for example generates without problems.

Can anybody help?

|||

I am having a huckuva time trying to get this to work as well. If someone else has any ideas, I would love to hear it.

However, I am working on a project that may work. I do not know if I can get to it soon, so I thought I would post the idea to see if someone else tried it -- to see if I am barking up the wrong tree.

I am using VS2005, MySQL 5, and MyODBC 3.51

I am viewing a TableAdapter in the DataSet Designer. I right-click on the TableAdapter and select Properties. Within the properties are the InsertCommand, DeleteCommand, and UpdateCopmmand methods. They are blank, of course, because as we have noticed, they can't automatically generate.

However, by expanding one of the commands (UpdateCommand, for example) we have access to the CommandText, where we can define the MySQL Command needed to update the table. We also have access to the Parameters, where we define the parameters we will pass.

If I get the chance, I will attempt to try this. If anyone else beats me to it, please let me know if it works.

|||

Someone in the Visual Basic General forum may be able to provide some insights as to why these particular drivers are not generating UPDATE commands.

To follow up on mking's theory, there is some good basic info on the TableAdapter class at: http://msdn2.microsoft.com/en-us/library/bz9tthwx.aspx with lots of good links (including http://msdn2.microsoft.com/en-us/library/dex7k4dw.aspx, which walks through the TableAdapter Configuration Wizard). This information should hopefully provide you with enough information to follow up on MKing's idea and generate the appropriate UPDATE statements.

For additional help with the TableAdapter Configuration Wizard, I'd recommend the Visual Basic General forum at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=32&SiteID=1. The ADO.NET forum might also be able to provide some assistance: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=45&SiteID=1.

Good luck,

Jason

|||Jason,

Thanks for the tips. However, after some intense drinking, I figured it out. Then I wrote a tutorial about it, which everyone can find on VBMySQl.com.

No comments:

Post a Comment