5 Replies - 480 Views - Last Post: 04 January 2013 - 01:56 AM Rate Topic: -----

#1 d.p.l.t  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-January 13

MySql UPDATE error with VB2010... HELP

Posted 02 January 2013 - 03:44 PM

this is the code i am using

when the try catch is executed the error is produced.. the MySqlCommand is skipped..

PLEASE help if you can


 Dim myConnString = ";" & _
        "Database = inventory;" & _
        "Uid = root;" & _
        "Pwd = root;" & _
        "Connect Timeout = 30;"

        Dim myupdateconnection As New MySqlConnection(myConnString)

        Dim commandUpdate As New MySqlCommand("UPDATE tblcustomer SET FirstName = '" & fName.Text & "'," & _
                                              "LastName = '" & lName.Text & "'," & _
                                              "Address = '" & addr.Text & "'," & _
                                              "StateProvince = '" & state.Text & "'," & _
                                              "ZipCode = '" & zip.Text & "'," & _
                                              "Country = '" & country.Text & "'," & _
                                              "Phone = '" & cNumber.Text & "'," & _
                                              "Fax = '" & fax.Text & "', " & _
                                              "WHERE CustomerID = '" & id.Text & "' ", myupdateconnection)



        Try
            myupdateconnection.Open()
            commandUpdate.ExecuteNonQuery()

        Catch
            MessageBox.Show("Error")
        Finally
            myupdateconnection.Close()
        End Try






Is This A Good Question/Topic? 0
  • +

Replies To: MySql UPDATE error with VB2010... HELP

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3197
  • View blog
  • Posts: 10,707
  • Joined: 12-December 12

Re: MySql UPDATE error with VB2010... HELP

Posted 02 January 2013 - 03:48 PM

I believe you need Connection Timeout.
Was This Post Helpful? 0
  • +
  • -

#3 d.p.l.t  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-January 13

Re: MySql UPDATE error with VB2010... HELP

Posted 02 January 2013 - 03:50 PM

View Postandrewsw, on 02 January 2013 - 03:48 PM, said:

I believe you need Connection Timeout.



i do have a Connection Timeout in the code
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,057
  • Joined: 02-July 08

Re: MySql UPDATE error with VB2010... HELP

Posted 02 January 2013 - 06:32 PM

Mother of all Connection Strings!
Was This Post Helpful? 0
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3710
  • View blog
  • Posts: 5,958
  • Joined: 08-June 10

Re: MySql UPDATE error with VB2010... HELP

Posted 02 January 2013 - 06:48 PM

Why are you ignoring the exception itself? You should be catching the exception and printing the error message. Just printing "Error" is pretty much useless.

Try
   ' Stuff...
Catch e As Exception
   MessageBox.Show("Error: " & e.Message)


Was This Post Helpful? 0
  • +
  • -

#6 artemix22  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 142
  • Joined: 21-January 12

Re: MySql UPDATE error with VB2010... HELP

Posted 04 January 2013 - 01:56 AM

one more, always use parameters, like charlie may and others say, it's more safety :bigsmile:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1