Dataset changes never reach Mysql host


S

Silby

Hi,

I've been trying to work with the latest mysql connector-net to try and
create a little program that helps me maintain a small mysql database.
Connecting to the database and filling a dataset works just fine. But when
i update something, nothing registers on the remote server.

The changes are saved correctly in the dataset, and upon calling
dataadapter.Update, nothing happens at all. No error, no updates :S

First i fill the dataset

myConnection.Open()

myDA.Fill(myDS, "woningen")
myDA.Fill(myDS, "fotos")

myConnection.Close()

Then i create a number of databindings to textboxes.

and to update, i do this:

bmWoningen.EndCurrentEdit()
myDS.Tables("woningen").AcceptChanges()
myDA.Update(myDS, "woningen")

And finally, here are my declarations (with a little editing of the
connection string :)

Dim myConnectString As String = "Database=xxxx;Data Source=xxxx;User
Id=xxxx;Password=xxxx"
Dim myConnection As New MySqlClient.MySqlConnection(myConnectString)
Dim myDS As New DataSet()
Dim myQuery As String = "SELECT * FROM woningen"
Dim myDA As New MySqlClient.MySqlDataAdapter(myQuery, myConnection)
Dim myCB As New MySqlClient.MySqlCommandBuilder()
Dim bmWoningen As BindingManagerBase


I hope someone can tell me what i'm doing wrong.

Regards
 
Ad

Advertisements

S

Silby

Miha Markic said:
Hi,

Remove AcceptChanges() call and it should work better. :)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Silby said:
Hi,

I've been trying to work with the latest mysql connector-net to try and
create a little program that helps me maintain a small mysql database.
Connecting to the database and filling a dataset works just fine. But
when i update something, nothing registers on the remote server.

The changes are saved correctly in the dataset, and upon calling
dataadapter.Update, nothing happens at all. No error, no updates :S

First i fill the dataset

myConnection.Open()

myDA.Fill(myDS, "woningen")
myDA.Fill(myDS, "fotos")

myConnection.Close()

Then i create a number of databindings to textboxes.

and to update, i do this:

bmWoningen.EndCurrentEdit()
myDS.Tables("woningen").AcceptChanges()
myDA.Update(myDS, "woningen")

And finally, here are my declarations (with a little editing of the
connection string :)

Dim myConnectString As String = "Database=xxxx;Data Source=xxxx;User
Id=xxxx;Password=xxxx"
Dim myConnection As New MySqlClient.MySqlConnection(myConnectString)
Dim myDS As New DataSet()
Dim myQuery As String = "SELECT * FROM woningen"
Dim myDA As New MySqlClient.MySqlDataAdapter(myQuery, myConnection)
Dim myCB As New MySqlClient.MySqlCommandBuilder()
Dim bmWoningen As BindingManagerBase


I hope someone can tell me what i'm doing wrong.

Regards

Hi,

Thanks for your hint.
Removing AcceptChanges() leaves me with the following error:
Only byte arrays can be serialized by MySqlBinary.

I presume this is a shortcoming in the mysql .net connector ?

Kind Regards
 
S

Silby

Found the problem.
It seems it was a 'bug' in an older version of the connector. Updating to
the latest version fixed it, along with the help of Miha :)
Thanks again for that !


Silby said:
Miha Markic said:
Hi,

Remove AcceptChanges() call and it should work better. :)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Silby said:
Hi,

I've been trying to work with the latest mysql connector-net to try and
create a little program that helps me maintain a small mysql database.
Connecting to the database and filling a dataset works just fine. But
when i update something, nothing registers on the remote server.

The changes are saved correctly in the dataset, and upon calling
dataadapter.Update, nothing happens at all. No error, no updates :S

First i fill the dataset

myConnection.Open()

myDA.Fill(myDS, "woningen")
myDA.Fill(myDS, "fotos")

myConnection.Close()

Then i create a number of databindings to textboxes.

and to update, i do this:

bmWoningen.EndCurrentEdit()
myDS.Tables("woningen").AcceptChanges()
myDA.Update(myDS, "woningen")

And finally, here are my declarations (with a little editing of the
connection string :)

Dim myConnectString As String = "Database=xxxx;Data Source=xxxx;User
Id=xxxx;Password=xxxx"
Dim myConnection As New MySqlClient.MySqlConnection(myConnectString)
Dim myDS As New DataSet()
Dim myQuery As String = "SELECT * FROM woningen"
Dim myDA As New MySqlClient.MySqlDataAdapter(myQuery, myConnection)
Dim myCB As New MySqlClient.MySqlCommandBuilder()
Dim bmWoningen As BindingManagerBase


I hope someone can tell me what i'm doing wrong.

Regards

Hi,

Thanks for your hint.
Removing AcceptChanges() leaves me with the following error:
Only byte arrays can be serialized by MySqlBinary.

I presume this is a shortcoming in the mysql .net connector ?

Kind Regards
 
M

Miha Markic [MVP C#]

Silby said:
Found the problem.
It seems it was a 'bug' in an older version of the connector. Updating to
the latest version fixed it, along with the help of Miha :)
Thanks again for that !

You're welcome :)
 
Ad

Advertisements

C

Cor Ligthert

Miha,

Now we have searchable MySql sample in Google, I have searched yesterday a
while for it and took to long for me to find.

:)

Cor
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top