after adding this it will update in datagrid.how can i view the selected row in datagrid in my textbox and will allow me to edit and update it.thank you!
Private Sub btnSave_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
if not conn.state=connectionstate.open then
conn.Open()
End If
Dim sql As String
sql = "INSERT into inventory (pcode, psup, pcat, pdescript, pstock, piprice, ptprice, pdate) values (@icode, @isup, @icat, @idesc, @istock, @iprice, @iptprice, @idate) "
Dim cmd As New OleDb.OleDbCommand(sql, conn)
cmd.Parameters.Add(New OleDb.OleDbParameter("@icode", txtPcode.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@isup", txtPsup.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@icat", txtPcat.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@idesc", txtPdesc.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@istock", txtPstock.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@iprice", txtPprice.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@iptprice", txtPtprice.Text))
cmd.Parameters.Add(New OleDb.OleDbParameter("@idate", txtPdate.Text))
cmd.ExecuteNonQuery()
conn.Close()
RefreshData()
MsgBox("Data Successfully Added!", MsgBoxStyle.Information, "Success")
Me.btnClear.PerformClick()
End Sub