locked
read/write to mysql RRS feed

  • Question

  • User-1389429259 posted

    Hi to all,

    on my localhost I have a Mysql instance running and a database.

    In my project I have:

     

    Try

    Dim ConnStr As String= "Server=localhost;Database=wordpress;uid=root;pwd=asdasd;"

    Dim con As MySql.Data.MySqlClient.MySqlConnection = New MySql.Data.MySqlClient.MySqlConnection(ConnStr)

    Dim cmd As MySql.Data.MySqlClient.MySqlCommand = New MySql.Data.MySqlClient.MySqlCommand("SELECT * FROM a_result")

    con.Open()

    MsgBox("done")

    Catch exception As MySql.Data.MySqlClient.MySqlException

    MsgBox("error")

    End Try

    it seems to work.

    I also have the variables: name as string, surname as string, age as integer and code as string

    Now, what I need, is to insert into the table the values where "code" does not exist or to update the table if "code" exists.

     

    Thank you

    Wednesday, August 3, 2011 5:06 AM

Answers

All replies