0

i am having trouble again ... i am creating a small vb.net 2010 windows application that saves first name, second name etc .. connected to mysql server database i wrote the save code and i am stuck in update, search, delete i am running out of time i should finish this after 4 hours helllllp here is my save code ... can anyone provide me with a matching delete, update, search code?

Dim conStr As String = ("Data Source=localhost;user id=root;password=123456;database=sam;")
    Try
        Dim con As New MySqlConnection(conStr)
        Dim cmd As MySqlCommand
        con.Open()

        Dim sqls As String = "INSERT INTO initial_nom(f_name,s_name,th_name,fo_name,app_no,adm_type) VALUES('" & TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "'," & TextBox5.Text & ",'" & ComboBox4.SelectedItem.ToString & "')"
        cmd = New MySqlCommand(sqls, con)
        cmd.ExecuteNonQuery()
    Catch ex As Exception
        MsgBox("Error in saving to Database")
        dbconn.Close()
    End Try
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
Sam
  • 9
  • 1
  • 7
  • 1
    8.7 **million** hits for "SQL UPDATE syntax" on [Google](http://bit.ly/1haWAPX) – Ňɏssa Pøngjǣrdenlarp Apr 19 '14 at 00:09
  • You have the basics. Just replace you sqls with the appropriate insert, delete, or update statements. Refer to this link for the exact syntax, http://www.w3schools.com/sql/default.asp – JerryKur Apr 19 '14 at 00:09
  • Also, please do some research on SQL Injection and parametrized queries. Your database and more can be compromised with a query such as this. http://stackoverflow.com/questions/16027925/select-from-mysql-put-into-variable-vb-net – InbetweenWeekends Apr 19 '14 at 01:49

0 Answers0