Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27467

VS 2008 Problem with delete record not in datagridview but in access

$
0
0
Hi to all
I'm new in VB.net and much newer in datagridview (This is my first datagridview)

I have a delete record button that delete the record from the datagrid but i'm unable to deleted also from the access table
the problem is in the
da.Update(ds, "master_roller") master_roller is my access table.

Any help is acceptable.

Thanks and regards

My code is this....

Quote:

Public Class Master_Roller_List_View
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter


Private Sub Master_Roller_List_View_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Master_RollerSQL = "...."
Call Fill_List()
End Sub

Private Sub Fill_List()
Try
con.ConnectionString = Main_Form.ConString
da = New OleDb.OleDbDataAdapter(Master_RollerSQL, con)
da.Fill(ds)
Master_Roller_DataGrid.DataSource = ds.Tables(0)
Master_Roller_DataGrid.Columns(0).Visible = False
Master_Roller_DataGrid.Columns(1).HeaderText = "??d."
Master_Roller_DataGrid.Columns(1).Width = 50
Master_Roller_DataGrid.Columns(2).HeaderText = "G?aµµ? ?????d???"
Master_Roller_DataGrid.Columns(2).Width = 70
Master_Roller_DataGrid.Columns(3).HeaderText = "??p?? ?????d???"
Master_Roller_DataGrid.Columns(3).Width = 130
Master_Roller_DataGrid.Columns(4).HeaderText = "?e????af? ?????d???"
Master_Roller_DataGrid.Columns(4).Width = 280
Master_Roller_DataGrid.Columns(5).HeaderText = "?fa?µ??? ?????d???"
Master_Roller_DataGrid.Columns(6).HeaderText = "?atas?e?ast??"
Master_Roller_DataGrid.Columns(7).HeaderText = "?pe?d?t??"
Master_Roller_DataGrid.Columns(8).HeaderText = "T?s? se µ??a??"
Master_Roller_DataGrid.Columns(9).HeaderText = "?e?e?ta?a ??s?"
Master_Roller_DataGrid.Columns(9).Width = 140
Master_Roller_DataGrid.Columns(10).HeaderText = "?e?e?t. ???µ??e?t??"
Master_Roller_DataGrid.Columns(10).Width = 125
Master_Roller_DataGrid.Refresh()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text)
End Try
Current_Click = -1
End Sub

Private Sub DelMasterRollerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DelMasterRollerToolStripMenuItem.Click
'??a??af? e???af?? µet? ap? ep?ßeßa??s?
Dim Answer As DialogResult
Answer = MsgBox("????e?te ?a ???e? d?a??af? t?? e???af?? " & vbCrLf & "??d???? = " & Master_Roller_DataGrid.CurrentRow.Cells(1).Value _
& vbCrLf & "G?aµµ? = " & Master_Roller_DataGrid.CurrentRow.Cells(2).Value _
& vbCrLf & "??p?? = " & Master_Roller_DataGrid.CurrentRow.Cells(3).Value _
& vbCrLf & "?e????af? = " & Master_Roller_DataGrid.CurrentRow.Cells(4).Value _
& vbCrLf & vbCrLf & "??ste s????????", MsgBoxStyle.YesNo, "??a??af? Roller")
If Answer = vbYes Then
Try
Dim i As Integer = Master_Roller_DataGrid.SelectedRows(0).Index
Master_Roller_DataGrid.Rows.Remove(Master_Roller_DataGrid.SelectedRows(0))
ds.Tables(0).Rows(i).Delete()
da.Update(ds, "master_roller")
MsgBox("? e???af? d?a???f??e")
List_Epil = -1
Call Disable_UDD()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub

Viewing all articles
Browse latest Browse all 27467

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>