vb.net Code:
  1. Dim sqlCon As New SqlConnection("Data Source=ICYCULYR\SQLEXPRESS;Initial Catalog=test_kcDB;Integrated Security=True;Pooling=False")
  2.         sqlCon.Open()
  3.         Dim sqlCommand As New SqlCommand()
  4.         sqlCommand.Connection = sqlCon
  5.         Dim returnValue As Object = "Nothing"
  6.         Select Case whichPreference
  7.             Case PreferencesEnum.dblClickMenu
  8.                 sqlCommand.CommandText = ("SELECT preferences_value FROM dataTable")
  9.                 Dim sqlReader As SqlDataReader = sqlCommand.ExecuteReader()
  10.                 Dim tmpInt As Integer = 0
  11.                 While sqlReader.Read()
  12.                     If tmpInt = whichPreference Then
  13.                         returnValue = sqlReader.GetValue(tmpInt)
  14.                         Exit While
  15.                     End If
  16.                     tmpInt += 1
  17.                 End While
  18.         End Select
  19.         sqlCon.Close()
the problem line is 'returnValue = sqlReader.GetValue(tmpInt)',
my value is DBNULL, but should return the first value of my column, which would be 'true'.

I assume sqlReader is reading the rows from my column 'preferences_value', so I don't see why it isn't working?
sqlReader.GetValue(tmpInt) (tmpInt being 0, as whichPreference is 0)
it should return the first row.

If anyone could help me with this?

Thanks