Hi...
The following code worked with 2.0 Framework, now with NPGSQL 2.0.11 and framework 4.0, this is erroring out despite Pooling=False for the connection. Do you get any clue?

The underlying logic is that add nodes to treeview; for each node added, immediately get subnodes and populate...


vb Code:
  1. Private Sub LoadRequirements(ByVal parnode As TreeNode)
  2.         Try
  3.             Dim CMd1 As NpgsqlCommand
  4.             CMd1 = New NpgsqlCommand
  5.             Dim Q As String = "SELECT REQID,SUMMARY,ISCHANGE,DEPENDENTBRS FROM FACTUALDATA.REQUIREMENTS WHERE PROJECT='{0}' AND BRID='{1}' AND PARENT='{2}' ORDER BY REQID"
  6.             If parnode Is Nothing Then
  7.                 CMd1.CommandText = String.Format(Q, Selected_project, lsvModules.SelectedItems(0).Text.Trim, lsvModules.SelectedItems(0).Text.Trim)
  8.             Else
  9.  
  10.                 CMd1.CommandText = String.Format(Q, Selected_project, lsvModules.SelectedItems(0).Text.Trim, parnode.Tag)
  11.             End If
  12.  
  13.             CMd1.Connection = CON
  14.             Dim R1 As NpgsqlDataReader = CMd1.ExecuteReader
  15.             While R1.Read
  16.                 Dim nd As New TreeNode
  17.                 With nd
  18.                     .Text = R1(0).ToString.Trim & " => " & R1(1).ToString.Trim
  19.                     If R1(2).ToString.Trim = "Y" And String.IsNullOrEmpty(R1(3).ToString.Trim) Then
  20.                         .ImageIndex = 12
  21.                         .SelectedImageIndex = 12
  22.                     ElseIf R1(2).ToString.Trim = "Y" And String.IsNullOrEmpty(R1(3).ToString.Trim) = False Then
  23.                         .ImageIndex = 14
  24.                         .SelectedImageIndex = 14
  25.                     ElseIf R1(2).ToString.Trim = "N" And String.IsNullOrEmpty(R1(3).ToString.Trim) Then
  26.                         .ImageIndex = 11
  27.                         .SelectedImageIndex = 11
  28.                     ElseIf R1(2).ToString.Trim = "N" And String.IsNullOrEmpty(R1(3).ToString.Trim) = False Then
  29.                         .ImageIndex = 13
  30.                         .SelectedImageIndex = 13
  31.                     End If
  32.                     .Tag = R1(0).ToString.Trim
  33.                     If parnode Is Nothing Then
  34.                         trvItems.Nodes.Add(nd)
  35.                     Else
  36.                         parnode.Nodes.Add(nd)
  37.                     End If
  38.                 End With
  39.  
  40.                 LoadRequirements(nd)
  41.                 nd.ExpandAll()
  42.             End While
  43.             R1.Close()
  44.             R1.Dispose()
  45.             'CM1.Dispose()
  46.         Catch ex As Exception
  47.             DE(ex)
  48.         End Try
  49.     End Sub