Protected Sub rp_mailList_ItemCommand(ByVal source As Object, ...
If e.CommandName = "Delete" Then
'*** mailID ***'
Dim lbl_mailID As Label = CType(e.Item.FindControl("lbl_mailID"), Label)
If (objConn.State = ConnectionState.Open) Then
objConn.Close()
End If
objConn.Open()
'*** Transaction Start ***'
Trans = objConn.BeginTransaction(IsolationLevel.ReadCommitted)
'*** Command ***'
With objCmd
.Connection = objConn
.Transaction = Trans
End With
Try
'*** Query ***'
strSQL = "DELETE FROM tb_mail " & _
" WHERE mail_id = '" & lbl_mailID.Text & "';"
objCmd.CommandText = strSQL
objCmd.CommandType = CommandType.Text
objCmd.ExecuteNonQuery()
'*** End Query ***'
'*** Commit Transaction ***'
Trans.Commit()
BindData()
Catch ex As Exception
'*** RollBack Transaction ***'
Trans.Rollback()
lbl_Alert.Visible = True
lbl_Alert.Text = "Record can not delete Error (" & ex.Message & ")"
End Try
objConn.Close()
End If