Bind RadioButtonList with Access DB at runtime

I can't figure out what I'm doing wrong to bind the value from my access db to the radiobuttonlist.  Please help.

Code Behind:

    Private Sub getUserInfo()
        Dim objConn As New System.Data.OleDb.OleDbConnection(System.Configuration.ConfigurationSettings.AppSettings("DSN"))
        Dim objCmd As System.Data.OleDb.OleDbCommand
        Dim dr As System.Data.OleDb.OleDbDataReader

        objCmd = New System.Data.OleDb.OleDbCommand("SELECT fname, lname, username, street, city, state, zipcode, phone, email, newsletter, moviereviews, christiananswers FROM Members WHERE UserName=@username", objConn)
        objCmd.Parameters.Add("@username", User.Identity.Name)


            dr = objCmd.ExecuteReader

            If dr.HasRows Then
                txtFName.Text = SNH(dr.Item("fname"))
                txtLName.Text = SNH(dr.Item("lname"))
                lblUserName.Text = SNH(dr.Item("username"))
                txtStreet.Text = SNH(dr.Item("street"))
                txtCity.Text = SNH(dr.Item("city"))
                txtState.Text = SNH(dr.Item("state"))
                txtZip.Text = SNH(dr.Item("zipcode"))
                txtPhone.Text = SNH(dr.Item("phone"))
                txtEmail.Text = SNH(dr.Item("email"))
      rdnewsletter.SelectedItem.Value = SNH(dr.Item("newsletter"))
      rdmoviereviews.SelectedItem.Value = SNH(dr.Item("moviereviews"))
      rdchristiananswers.SelectedItem.Value = SNH(dr.Item("christiananswers"))
            End If

        Catch ex As System.Exception
            lblResult.Text = "There was an error accessing your account: " & ex.Message
            lblResult.ForeColor = System.Drawing.Color.Red
        End Try

    End Sub

    Private Function SNH(ByVal arg As Object) As String
        If Microsoft.VisualBasic.IsDBNull(arg) Then Return String.Empty
        Return Microsoft.VisualBasic.Trim(CType(arg, String))
    End Function



<asp:RadioButtonList DataMember="Members" DataTextField="newsletter" DataValueField="newsletter" DataSource='<%# DataBinder.Eval(Container, "newsletter" )%>' ID="rdnewsletter" runat="server" RepeatDirection="Horizontal"></asp:RadioButtonList>
Who is Participating?
HI there,

There is heaps of articles on this, have a look see how you go. It's 2am where I live so i'm going to bed. I should be online tomorrow.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.