Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim cmd As New MySqlCommand
If NewRecord = True Then
connect()
cmd = New MySqlCommand("insert into books (bookid, bookname, authorname, bookprice, bookstocks) values (bookid = " & txtBookID.Text & ", bookname = '" & txtBookName.Text & "', authorname = " & cboAuthor.DisplayMember & ", bookprice = " & txtBookPrice.Text & ", bookstocks = " & nudBookStocks.Text & ")", con)
cmd.ExecuteNonQuery()
MessageBox.Show("New book record saved!", "Book Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
disconnect()
ElseIf NewRecord = False Then
connect()
cmd = New MySqlCommand("update products.books set bookname = '" & txtBookName.Text & "', bookprice = " & txtBookPrice.Text & ", authorname = " & cboAuthor.DisplayMember & ", bookstocks = " & nudBookStocks.Text & " where bookid = " & txtBookID.Text & "", con)
cmd.ExecuteNonQuery()
MessageBox.Show("Books record updated!", "Update Books", MessageBoxButtons.OK, MessageBoxIcon.Information)
disconnect()
End If
clear()
End Sub
and when i looked at the table it save's zeros(0)..can you help me?

New Topic/Question
This topic is locked



MultiQuote







|