Hi,
this will work in Edit button click,Getting values from combobox and given input to query.Oprdgv is my Datagrid.
I got the error Like,
"unable to cast the type 'system.int32' to type 'system.data.datatable"
Private Sub EditButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditButton.Click
Dim mcode As String = MccodeCombo.SelectedValue
Dim pcode As String = ProdCombo.SelectedValue
OprDgv.Columns.Add("Prodcd", "Prodcode")
OprDgv.Columns.Add("Mccode", "Mccode")
OprDgv.Columns.Add("Oprno", "Oprno")
OprDgv.Columns.Add("OPname", "Oprname")
OprDgv.Columns.Add("Stime", "Settime")
OprDgv.Columns.Add("Stdpc", "StdPc")
OprDgv.Columns.Add("Ratepc", "Ratepc")
OprDgv.Columns(0).Width = 50
con = New SqlConnection(constr)
cmdstr = "Select * from Operations where Mccode='" & mcode & "'and Prodcode='" & pcode & "'"
dt = DataManager.ExecuteNonQuery(constr, cmdstr)
Dim rc As Integer = dt.Rows.Count
If (rc > 0) Then
For i = 0 To rc - 1
OprDgv.Rows.Add()
OprDgv.Item(0, i).Value = dt.Rows(i).Item("Prodcode")
OprDgv.Item(1, i).Value = dt.Rows(i).Item("Mccode")
OprDgv.Item(2, i).Value = dt.Rows(i).Item("Oprno")
OprDgv.Item(3, i).Value = dt.Rows(i).Item("Oprname")
OprDgv.Item(4, i).Value = dt.Rows(i).Item("Settime")
OprDgv.Item(5, i).Value = dt.Rows(i).Item("Stdpcshift")
OprDgv.Item(6, i).Value = dt.Rows(i).Item("Ratepc")
Next
Else
MessageBox.Show("No Record Found")
End If
End Sub