guys plss help me with this need urgent why i cannot delete row in database
this my code
Try
Dim dsql As String
Dim connect As New OleDbConnection(conString)
connect.Open()
dsql = "DELETE "
dsql = dsql & "FROM InventoryItem "
dsql = dsql & "WHERE TransactionDate = '" & TransactionDateText.Value & "' AND "
dsql = dsql & "ItemName = '" & ItemNameText.Text & "' AND Quantity = '" & QuantityText.Text & "' AND "
dsql = dsql & "Price = '" & PriceText.Text & "' AND Cost = '" & CostText.Text & "' AND "
dsql = dsql & "Type = '" & InTextbox.Text & "'"
MessageBox.Show(dsql)
Dim command As New OleDbCommand(dsql, connect)
Dim n As Integer = 0
n = command.ExecuteNonQuery
If n <> 0 Then
MsgBox("Transaction Deleted", MsgBoxStyle.Information)
Else
MsgBox("Transaction Not Deleted", MsgBoxStyle.Information)
End If
Catch ex As Exception
MsgBox("ERROR : " & ex.Message.ToString)
End Try
i put that code in a button
when the user click a row in datagrid it will put the data to textbox and after that when the button click the above code will executed..
but i got an error "Data Type Mismatch In Criteria Expression" help me guys