3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by mh.cool992
0
Private Sub ButtonAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Try
Call OpenConnection()
Dim v1 As Integer
Dim v2 As Integer = ListView1.Items(0).SubItems(3).Text
Dim ans As Integer
Dim SQLQuery As String = "Update([INVENTRY] Where [QTY]" = v1 )
ans = v1 - v2
With OleDa
.UpdateCommand = New OleDb.OleDbCommand()
.UpdateCommand.CommandText = "UPDATE [INVENTRY] SET [ItemCode] = @ItemCode , [ItemName] = @ItemName , [QTY] = @QTY , [SalePrice] = @SalePrice , [PurchasePrice] = @PurchasePrice WHERE (EmployeeID = ?)"
.UpdateCommand.Connection = OleCn
.UpdateCommand.Parameters.Add("@ItemCode", OleDb.OleDbType.VarWChar, 50, "ItemCode").Value = ListView1.Items(0).Text
.UpdateCommand.Parameters.Add("@ItemName", OleDb.OleDbType.VarWChar, 50, "ItemName").Value = ListView1.Items(0).SubItems(1).Text
.UpdateCommand.Parameters.Add("@QTY", OleDb.OleDbType.VarWChar, 50, "QTY").Value = ans
.UpdateCommand.Parameters.Add("@SalePrice", OleDb.OleDbType.VarWChar, 50, "SalePrice").Value = ListView1.Items(0).SubItems(3).Text
.UpdateCommand.Parameters.Add("@PurchasePrice", OleDb.OleDbType.VarWChar, 50, "PurchasePrice").Value = ListView1.Items(0).SubItems(4).Text
End With
Call CloseConnection()
MsgBox("Record(s) has been Updated...", MsgBoxStyle.Information, "Record(s) Updated...")
Me.Close()
Catch ex As Exception
MsgBox("Unable to update record(s), Employee ID already exist, please enter another Employee ID...", MsgBoxStyle.Exclamation, "Attention...")
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error...")
Call CloseConnection()
End Try
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.