Solved

VS 2008

Posted on 2014-10-02
1
87 Views
Last Modified: 2014-10-05
Hi Experts
I am using the following code bring VFP data into Sql Express.
my code
  Dim connVfp As String = "Provider=VFPOLEDB.1;Data Source=c:\mas_progs\ggarage_prog\data3\garage.dbc"
    Public conVfp As New OleDb.OleDbConnection(connVfp)
    Public dsVfp As New DataSet
    Public DTVfp As New DataTable
    Public daVfp As DataAdapter

    Dim connExp As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\bill\Garage\GarageDatabase.mdf;Integrated Security=True;User Instance=True"
    Public conExp As New SqlConnection(connExp)
    Public dsExp As New DataSet
    Public DTexp As New DataTable
    Public daexp As DataAdapter
    Public ccodex As String
    Public ccodeexist = "Y"
   Dim davfp As New OleDbDataAdapter(" select * FROM Customer ", conVfp)
        Dim daExp As New SqlDataAdapter(" select * FROM Customer ", conExp)
    davfp.Fill(DTVfp)
        daExp.Fill(DTexp)
     DataGridView1.DataSource = DTVfp
        DataGridView2.DataSource = DTexp
it works fine upto here
when
     For Each rowa In DTVfp.Rows
            ccodeexist = "N"
            ccodex = rowa("ccode")
            If IsDBNull(rowa("ccode")) = False Then
                For Each rowb In DTexp.Rows
                    If IsDBNull(rowb("ccode")) = False Then
                        If rowb("ccode") = ccodex Then
                            ccodeexist = "Y"
                            Exit For
                        End If
                    End If
                Next
                If ccodeexist <> "Y" Then
                    Dim rown As DataRow = DTexp.NewRow()
                    rown("Ccode") = rowa("ccode")
                    rown("C_name") = rowa("c_name")
                    rown("title") = rowa("title")
                    DTexp.Rows.Add(rown)
                End If
            End If
next

This table has 20000 records and after a minute I get the following Error:

ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x4d3b900 to COM context 0x4d3ba70 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
0
Comment
Question by:b001
1 Comment
 
LVL 22

Accepted Solution

by:
plusone3055 earned 500 total points
Comment Utility
In visual studio

hit
CTRL + ALT + E

click managed debugging assistants
and UNCHECK
contextSwitchDeadlock

Save , rebuild and you should be good to go :) Screenshot

ContextSwitchDealdlock
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now