Hai i have a probleam with my coding.The error which i got is olehDBexeception was unhandled.In my coding here i am developing function
use to subtract number in database based on user input.I dont how to solve this
error , please some help me to correct my coding here. I also highlight the line cause\
an error and also i attach picture of the probleam.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'open db connection'
Dim Con As New OleDb.OleDbConnection("Provider=SQLOLEDB ;Data Source=Danawa;Initial Catalog=Store;Integrated Security=SSPI ")
Try
Con.Open()
Catch ex As InvalidOperationException
MsgBox(ex.Message)
End Try
'start transaction'
Dim Trans = Con.BeginTransaction
'define a sql command statement'
Dim cmd As New OleDb.OleDbCommand("UPDATE ItemIn SET Itemquantity= Itemquantity - @IQ WHERE ItemName=@IN", Con, Trans)
cmd.Parameters.AddWithValue("@IQ", Int32.Parse(ItemquantityTextBox.Text))
cmd.Parameters.AddWithValue("@IN", ItemNameComboBox.Text)
'execute the command'
cmd.ExecuteNonQuery() // The probleam are from here//
Trans.Commit()
Con.Close()
End Sub
Bookmarks