none
OleDbDataAdapter hangup RRS feed

  • Question

  • This program hangup after a short time.

    Wat can be the problem. ( Sory i'm Duth )

    ...........................................................

     Private Sub DataGridViewLijsten_RowHeaderMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridViewLijsten.RowHeaderMouseClick

            lijst = ""
            Dim dr As New DataGridViewRow
            dr = DataGridViewLijsten.CurrentRow
            If Not IsDBNull(dr.Cells.Item(0).Value) Then lijst = CStr(dr.Cells.Item(0).Value)
            If lijst <> "" Then VulWoordenLijst()
        End Sub

     

    Private Sub VulWoordenLijst()
            Dim x As Integer
            ReDim woorden(100)
            aantalwoorden = 0

            metable.Clear()
            adapter.SelectCommand = New OleDbCommand("Select * from " + lijst, connection)
            '        Try
            adapter.Fill(metable)
            aantalwoorden = metable.Rows.Count
            Me.lAantalwoorden.Text = "Aantal woorden = " & aantalwoorden
            bindingSource.DataSource = metable
            DataGridViewWoorden.DataSource = bindingSource
            DataGridViewWoorden.Columns.Item(0).Width = 150
            Catch ex As Exception
                MaakNieuweTabel()
                VulWoordenLijst()
            End Try

            x = 0
            Dim row As DataRow
            For Each row In metable.Rows
                x = x + 1
                woorden(x) = row.ItemArray(0).ToString
            Next
            start()
            Exit Sub
        End Sub

    ..........................................................

    • Moved by Aspen VJ Monday, December 13, 2010 8:23 AM (From:Windows Forms Data Controls and Databinding)
    • Changed type DeUil Friday, February 11, 2011 12:50 PM
    • Changed type DeUil Thursday, February 17, 2011 7:44 PM
    Friday, December 10, 2010 5:02 PM

Answers

  • Hard to say what could be wrong, but you could try following:

    1. Put tracing into your code using Trace class. It would allow you to collect information from your running application to see which specific line of code causes the issue

    2. If you are connecting to SQL Server, try to use SQL Profiler to see what is passed from the application to SQL server and then try to troubleshoot those queries in Management Studio. If query takes very long time to execute, it could be the reason why application hangs.


    Val Mazur (MVP)

    http://www.xporttools.net

    • Marked as answer by liurong luo Thursday, December 16, 2010 1:28 PM
    • Unmarked as answer by DeUil Wednesday, January 5, 2011 10:25 AM
    • Marked as answer by DeUil Wednesday, January 5, 2011 10:26 AM
    • Unmarked as answer by DeUil Wednesday, January 5, 2011 10:27 AM
    • Marked as answer by DeUil Wednesday, January 5, 2011 10:39 AM
    • Unmarked as answer by DeUil Wednesday, January 5, 2011 10:39 AM
    • Marked as answer by DeUil Friday, February 25, 2011 8:44 AM
    Monday, December 13, 2010 11:13 AM
    Moderator