vks.gautam1
Well-known member
Here i have two Tables --- " Mef_Info " , "Mef_Detail.
Pack_no is same field in both tables
i fill both the tables in Datatables.
& want to fill datagridview.
but it is not working.
But getting this error-
contactswitchdeadlock was detected.
" The CLR has been unable to transition from COM context 0x1a0c48 to COM context 0x1a0db8 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. "
Pack_no is same field in both tables
i fill both the tables in Datatables.
& want to fill datagridview.
but it is not working.
But getting this error-
contactswitchdeadlock was detected.
" The CLR has been unable to transition from COM context 0x1a0c48 to COM context 0x1a0db8 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. "
VB.NET:
Public Class frmDatasetRelation
Dim cn As OleDbConnection
Dim cmd As String
Dim ds As DataSet
Dim ad As OleDbDataAdapter
Private Sub btnDatTableRelation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDatTableRelation.Click
Try
cn = New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=Data source path;")
cn.Open()
cmd = "select * from mef_info where khattar_dt>#11/14/2008#"
ds = New DataSet
ad = New OleDbDataAdapter(cmd, cn)
ad.Fill(ds, "mef_info")
cmd = "select * from mef_detail"
ad = New OleDbDataAdapter(cmd, cn)
ad.Fill(ds, "mef_detail")
Dim relation As New DataRelation("Mef", ds.Tables("Mef_Info").Columns("Pack_no"), ds.Tables("Mef_Detail").Columns("Pack_no"))
ds.Relations.Add(relation)
Dim dv As New DataView(ds.Tables("mef_Info"))
DataGridView1.DataSource = dv
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class