I am using the following code bring VFP data into Sql Express.
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)
DataGridView1.DataSource = DTVfp
DataGridView2.DataSource = DTexp
it works fine upto here
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"
If ccodeexist <> "Y" Then
Dim rown As DataRow = DTexp.NewRow()
rown("Ccode") = rowa("ccode")
rown("C_name") = rowa("c_name")
rown("title") = rowa("title")
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.