منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : Attempted to read or write protected memory مشكلة في قاعدة بيانات و chart
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
[COLOR="#0000FF"][COLOR="#FF0000"]السلام عليكم شباب ....... عندما اشغل البرنامج يحصل لي الخطاء التالي :
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
هذا هو الكود ........[/COLOR][/COLOR]
.

[HTML][HTML][HTML][HTML][HTML]
PHP كود :
[HTML][HTML][CODE][HTML][HTML][HTML][HTML]
Imports System.Data.OleDb[align=left][align=left]
Imports System.Windows.Forms.DataVisualization.Charting

Public Class Form1

    
Private Sub Table1BindingNavigatorSaveItem_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Table1BindingNavigatorSaveItem.Click
        Me
.Validate()
        
Me.Table1BindingSource.EndEdit()
        
Me.TableAdapterManager.UpdateAll(Me.SampleDataSet)

    
End Sub

    
Private Sub Table1DataGridView_CellContentClick(ByVal sender As System.ObjectByVal e As System.Windows.Forms.DataGridViewCellEventArgsHandles Table1DataGridView.CellContentClick
        
If TextBox1.Text.Length 0 Then
            MessageBox
.Show("Load The Database Please""OAO Software"MessageBoxButtons.OKMessageBoxIcon.Exclamation)
            
DataGridViewTextBoxColumn2.Clone()
        ElseIf 
TextBox1.Text.Length 0 Then

        End 
If

    
End Sub


    
'~~> Code required to browse for the Access Database File

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        With OpenFileDialog1
            .DefaultExt = "accdb"
            .DereferenceLinks = True
            .Filter = _
             "Access files (*.accdb)|*.accdb"
            .Multiselect = False
            .Title = "Select an Access Database file to open"
            .ValidateNames = True
            Try
                If .ShowDialog = Windows.Forms.DialogResult.OK Then
                    Try
                        TextBox1.Text = .FileName
                    Catch fileException As Exception
                        Throw fileException
                    End Try
                End If
            Catch ex As Exception
                MessageBox.Show("Load The Database Please", "OAO Software", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End Try
        End With


    End Sub

    '
~~> Code to generate the chart
    
Private Sub Button2_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button2.Click


        Dim strConn 
As String "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" TextBox1.Text _
        
";Persist Security Info=False;"
        
Dim tblFields As String "SELECT * from Table1"

        
Dim conn As New OleDbConnection(strConn)
        
Dim oCmd As New OleDbCommand(tblFieldsconn)
        
Dim oData As New OleDbDataAdapter(tblFieldsconn)
        
Dim ds As New DataSet

        conn
.Open()
        
oData.Fill(ds"Table1")
        
conn.Close()

        
Chart1.DataSource ds.Tables("Table1")
        
Dim Series1 As Series Chart1.Series("Series1")
        
Chart1.Series(Series1.Name).ChartType SeriesChartType.Spline


        Chart1
.Series(Series1.Name).XValueMember "nFruits"
        
Chart1.Series(Series1.Name).YValueMembers "nSales"

        
Chart1.Size = New System.Drawing.Size(780350)

    
End Sub


    
Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        
'TODO: This line of code loads data into the 'SampleDataSet.Table1' table. You can move, or remove it, as needed.
        Me.Table1TableAdapter.Fill(Me.SampleDataSet.Table1)

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Table1BindingNavigatorSaveItem.PerformClick()
        MessageBox.Show("Updated", "OAO Software", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        BindingNavigatorDeleteItem.PerformClick()
        MessageBox.Show("Deleted", "OAO Software", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    End Sub

   
End Class[/align][/align][/HTML][/HTML][/HTML][/HTML][/CODE][/HTML][/HTML] 
[/HTML][/HTML][/HTML][/HTML][/HTML]