Check box

Discussion in 'ASP .Net' started by JJ297, Jul 27, 2007.

  1. JJ297

    JJ297 Guest

    Hello can someone assist me...


    I've added two check boxes to my page


    <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    <asp:CheckBox ID="ChkNo" runat="server" Text="No" /

    I have a stored procedure set up to enter in the Yes or No answer.
    How do I set that up on the code behind page?

    This is what I have thus far, all of the other data on the page is
    going into the database now I just need to add the check box value.

    The two fields in the Database are called DisplayedQues and
    NonDisplayedQues

    Dim question As String = TxtQuestion.Text
    Dim answer As String = TxtAnswer.Text


    Dim conn As New Data.SqlClient.SqlConnection("Data
    Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    Info=True;User ID=EDCSFAQUser;Password=fax")

    Dim cmd As New Data.SqlClient.SqlCommand
    With cmd
    ..Connection = conn 'the connection
    ..CommandType = Data.CommandType.StoredProcedure
    ..CommandText = "EnterAdminQuestion"
    ..Parameters.AddWithValue("@topicid",
    CInt(DropDownList1.SelectedItem.Value))
    ..Parameters.AddWithValue("@quesdate", QuesDate.Text)
    ..Parameters.AddWithValue("@questions", TxtQuestion.Text)
    ..Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    ..Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    ..Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)

    Thanks so much.
     
    JJ297, Jul 27, 2007
    #1
    1. Advertising

  2. Dim displayedQues as Boolean = False
    Dim nonDisplayedQues as Boolean = False

    If (ChkYes.Checked) Then
    displayedQues = True
    End If

    If (ChkNo.Checked) Then
    nonDisplayedQues = True
    End If


    Dim cmd As New Data.SqlClient.SqlCommand
    With cmd
    ..Connection = conn 'the connection
    ..CommandType = Data.CommandType.StoredProcedure
    ..CommandText = "EnterAdminQuestion"
    ..Parameters.AddWithValue("@topicid",
    CInt(DropDownList1.SelectedItem.Value))
    ..Parameters.AddWithValue("@quesdate", QuesDate.Text)
    ..Parameters.AddWithValue("@questions", TxtQuestion.Text)
    ..Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    ..Parameters.AddWithValue("@DisplayedQues", displayedQues)
    ..Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com
    Co-author: Microsoft Expression Web Bible (upcoming)

    ************************************************
    Think outside the box!
    ************************************************
    "JJ297" <> wrote in message
    news:...
    > Hello can someone assist me...
    >
    >
    > I've added two check boxes to my page
    >
    >
    > <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    > <asp:CheckBox ID="ChkNo" runat="server" Text="No" /
    >
    > I have a stored procedure set up to enter in the Yes or No answer.
    > How do I set that up on the code behind page?
    >
    > This is what I have thus far, all of the other data on the page is
    > going into the database now I just need to add the check box value.
    >
    > The two fields in the Database are called DisplayedQues and
    > NonDisplayedQues
    >
    > Dim question As String = TxtQuestion.Text
    > Dim answer As String = TxtAnswer.Text
    >
    >
    > Dim conn As New Data.SqlClient.SqlConnection("Data
    > Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    > Info=True;User ID=EDCSFAQUser;Password=fax")
    >
    > Dim cmd As New Data.SqlClient.SqlCommand
    > With cmd
    > .Connection = conn 'the connection
    > .CommandType = Data.CommandType.StoredProcedure
    > .CommandText = "EnterAdminQuestion"
    > .Parameters.AddWithValue("@topicid",
    > CInt(DropDownList1.SelectedItem.Value))
    > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    > .Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    > .Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)
    >
    > Thanks so much.
    >
     
    Cowboy \(Gregory A. Beamer\), Jul 27, 2007
    #2
    1. Advertising

  3. JJ297

    JJ297 Guest

    On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
    <> wrote:
    > Dim displayedQues as Boolean = False
    > Dim nonDisplayedQues as Boolean = False
    >
    > If (ChkYes.Checked) Then
    > displayedQues = True
    > End If
    >
    > If (ChkNo.Checked) Then
    > nonDisplayedQues = True
    > End If
    >
    > Dim cmd As New Data.SqlClient.SqlCommand
    > With cmd
    > .Connection = conn 'the connection
    > .CommandType = Data.CommandType.StoredProcedure
    > .CommandText = "EnterAdminQuestion"
    > .Parameters.AddWithValue("@topicid",
    > CInt(DropDownList1.SelectedItem.Value))
    > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    > .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    > .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    > Co-author: Microsoft Expression Web Bible (upcoming)
    >
    > ************************************************
    > Think outside the box!
    > ************************************************"JJ297" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > Hello can someone assist me...

    >
    > > I've added two check boxes to my page

    >
    > > <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    > > <asp:CheckBox ID="ChkNo" runat="server" Text="No" /

    >
    > > I have a stored procedure set up to enter in the Yes or No answer.
    > > How do I set that up on the code behind page?

    >
    > > This is what I have thus far, all of the other data on the page is
    > > going into the database now I just need to add the check box value.

    >
    > > The two fields in the Database are called DisplayedQues and
    > > NonDisplayedQues

    >
    > > Dim question As String = TxtQuestion.Text
    > > Dim answer As String = TxtAnswer.Text

    >
    > > Dim conn As New Data.SqlClient.SqlConnection("Data
    > > Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    > > Info=True;User ID=EDCSFAQUser;Password=fax")

    >
    > > Dim cmd As New Data.SqlClient.SqlCommand
    > > With cmd
    > > .Connection = conn 'the connection
    > > .CommandType = Data.CommandType.StoredProcedure
    > > .CommandText = "EnterAdminQuestion"
    > > .Parameters.AddWithValue("@topicid",
    > > CInt(DropDownList1.SelectedItem.Value))
    > > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    > > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    > > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    > > .Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    > > .Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)

    >
    > > Thanks so much.- Hide quoted text -

    >
    > - Show quoted text -



    Thanks for assisting me I'm all set but have another question...

    I have a field in this same database called CDPPin. I'm using a
    session variable to get the pin. How do I call it? Do I...

    Dim Session (CDPUser)

    Then call it like this?

    > .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    > .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)

    .. Parameters.AddWithValue("@CDPPin", CDPPin)?
     
    JJ297, Jul 27, 2007
    #3
  4. JJ297

    Lit Guest

    Dim CDPPin as Integer
    CDPPin = CType(Session("CDPUser"), Integer)

    pass CDPPin to Stored procedure.


    "JJ297" <> wrote in message
    news:...
    > On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
    > <> wrote:
    >> Dim displayedQues as Boolean = False
    >> Dim nonDisplayedQues as Boolean = False
    >>
    >> If (ChkYes.Checked) Then
    >> displayedQues = True
    >> End If
    >>
    >> If (ChkNo.Checked) Then
    >> nonDisplayedQues = True
    >> End If
    >>
    >> Dim cmd As New Data.SqlClient.SqlCommand
    >> With cmd
    >> .Connection = conn 'the connection
    >> .CommandType = Data.CommandType.StoredProcedure
    >> .CommandText = "EnterAdminQuestion"
    >> .Parameters.AddWithValue("@topicid",
    >> CInt(DropDownList1.SelectedItem.Value))
    >> .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    >> .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    >> .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    >> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    >> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
    >>
    >> --
    >> Gregory A. Beamer
    >> MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    >> Co-author: Microsoft Expression Web Bible (upcoming)
    >>
    >> ************************************************
    >> Think outside the box!
    >> ************************************************"JJ297" <>
    >> wrote in message
    >>
    >> news:...
    >>
    >>
    >>
    >> > Hello can someone assist me...

    >>
    >> > I've added two check boxes to my page

    >>
    >> > <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    >> > <asp:CheckBox ID="ChkNo" runat="server" Text="No" /

    >>
    >> > I have a stored procedure set up to enter in the Yes or No answer.
    >> > How do I set that up on the code behind page?

    >>
    >> > This is what I have thus far, all of the other data on the page is
    >> > going into the database now I just need to add the check box value.

    >>
    >> > The two fields in the Database are called DisplayedQues and
    >> > NonDisplayedQues

    >>
    >> > Dim question As String = TxtQuestion.Text
    >> > Dim answer As String = TxtAnswer.Text

    >>
    >> > Dim conn As New Data.SqlClient.SqlConnection("Data
    >> > Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    >> > Info=True;User ID=EDCSFAQUser;Password=fax")

    >>
    >> > Dim cmd As New Data.SqlClient.SqlCommand
    >> > With cmd
    >> > .Connection = conn 'the connection
    >> > .CommandType = Data.CommandType.StoredProcedure
    >> > .CommandText = "EnterAdminQuestion"
    >> > .Parameters.AddWithValue("@topicid",
    >> > CInt(DropDownList1.SelectedItem.Value))
    >> > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    >> > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    >> > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    >> > .Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    >> > .Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)

    >>
    >> > Thanks so much.- Hide quoted text -

    >>
    >> - Show quoted text -

    >
    >
    > Thanks for assisting me I'm all set but have another question...
    >
    > I have a field in this same database called CDPPin. I'm using a
    > session variable to get the pin. How do I call it? Do I...
    >
    > Dim Session (CDPUser)
    >
    > Then call it like this?
    >
    >> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    >> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)

    > . Parameters.AddWithValue("@CDPPin", CDPPin)?
    >
     
    Lit, Jul 27, 2007
    #4
  5. Assuming it is an Integer. If not, you will have to change to the correct
    type, but Lit is right on track with the solution.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com
    Co-author: Microsoft Expression Web Bible (upcoming)

    ************************************************
    Think outside the box!
    ************************************************
    "Lit" <> wrote in message
    news:...
    > Dim CDPPin as Integer
    > CDPPin = CType(Session("CDPUser"), Integer)
    >
    > pass CDPPin to Stored procedure.
    >
    >
    > "JJ297" <> wrote in message
    > news:...
    >> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
    >> <> wrote:
    >>> Dim displayedQues as Boolean = False
    >>> Dim nonDisplayedQues as Boolean = False
    >>>
    >>> If (ChkYes.Checked) Then
    >>> displayedQues = True
    >>> End If
    >>>
    >>> If (ChkNo.Checked) Then
    >>> nonDisplayedQues = True
    >>> End If
    >>>
    >>> Dim cmd As New Data.SqlClient.SqlCommand
    >>> With cmd
    >>> .Connection = conn 'the connection
    >>> .CommandType = Data.CommandType.StoredProcedure
    >>> .CommandText = "EnterAdminQuestion"
    >>> .Parameters.AddWithValue("@topicid",
    >>> CInt(DropDownList1.SelectedItem.Value))
    >>> .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    >>> .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    >>> .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    >>> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    >>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
    >>>
    >>> --
    >>> Gregory A. Beamer
    >>> MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    >>> Co-author: Microsoft Expression Web Bible (upcoming)
    >>>
    >>> ************************************************
    >>> Think outside the box!
    >>> ************************************************"JJ297"
    >>> <> wrote in message
    >>>
    >>> news:...
    >>>
    >>>
    >>>
    >>> > Hello can someone assist me...
    >>>
    >>> > I've added two check boxes to my page
    >>>
    >>> > <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    >>> > <asp:CheckBox ID="ChkNo" runat="server" Text="No" /
    >>>
    >>> > I have a stored procedure set up to enter in the Yes or No answer.
    >>> > How do I set that up on the code behind page?
    >>>
    >>> > This is what I have thus far, all of the other data on the page is
    >>> > going into the database now I just need to add the check box value.
    >>>
    >>> > The two fields in the Database are called DisplayedQues and
    >>> > NonDisplayedQues
    >>>
    >>> > Dim question As String = TxtQuestion.Text
    >>> > Dim answer As String = TxtAnswer.Text
    >>>
    >>> > Dim conn As New Data.SqlClient.SqlConnection("Data
    >>> > Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    >>> > Info=True;User ID=EDCSFAQUser;Password=fax")
    >>>
    >>> > Dim cmd As New Data.SqlClient.SqlCommand
    >>> > With cmd
    >>> > .Connection = conn 'the connection
    >>> > .CommandType = Data.CommandType.StoredProcedure
    >>> > .CommandText = "EnterAdminQuestion"
    >>> > .Parameters.AddWithValue("@topicid",
    >>> > CInt(DropDownList1.SelectedItem.Value))
    >>> > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    >>> > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    >>> > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    >>> > .Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    >>> > .Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)
    >>>
    >>> > Thanks so much.- Hide quoted text -
    >>>
    >>> - Show quoted text -

    >>
    >>
    >> Thanks for assisting me I'm all set but have another question...
    >>
    >> I have a field in this same database called CDPPin. I'm using a
    >> session variable to get the pin. How do I call it? Do I...
    >>
    >> Dim Session (CDPUser)
    >>
    >> Then call it like this?
    >>
    >>> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    >>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)

    >> . Parameters.AddWithValue("@CDPPin", CDPPin)?
    >>

    >
    >
     
    Cowboy \(Gregory A. Beamer\), Jul 27, 2007
    #5
  6. JJ297

    JJ297 Guest

    On Jul 27, 5:51 pm, "Cowboy \(Gregory A. Beamer\)"
    <> wrote:
    > Assuming it is an Integer. If not, you will have to change to the correct
    > type, but Lit is right on track with the solution.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    > Co-author: Microsoft Expression Web Bible (upcoming)
    >
    > ************************************************
    > Think outside thebox!
    > ************************************************"Lit" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > Dim CDPPin as Integer
    > > CDPPin = CType(Session("CDPUser"), Integer)

    >
    > > pass CDPPin to Stored procedure.

    >
    > > "JJ297" <> wrote in message
    > >news:...
    > >> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
    > >> <> wrote:
    > >>> Dim displayedQues as Boolean = False
    > >>> Dim nonDisplayedQues as Boolean = False

    >
    > >>> If (ChkYes.Checked) Then
    > >>> displayedQues = True
    > >>> End If

    >
    > >>> If (ChkNo.Checked) Then
    > >>> nonDisplayedQues = True
    > >>> End If

    >
    > >>> Dim cmd As New Data.SqlClient.SqlCommand
    > >>> With cmd
    > >>> .Connection = conn 'the connection
    > >>> .CommandType = Data.CommandType.StoredProcedure
    > >>> .CommandText = "EnterAdminQuestion"
    > >>> .Parameters.AddWithValue("@topicid",
    > >>> CInt(DropDownList1.SelectedItem.Value))
    > >>> .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    > >>> .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    > >>> .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    > >>> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    > >>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)

    >
    > >>> --
    > >>> Gregory A. Beamer
    > >>> MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    > >>> Co-author: Microsoft Expression Web Bible (upcoming)

    >
    > >>> ************************************************
    > >>> Think outside thebox!
    > >>> ************************************************"JJ297"
    > >>> <> wrote in message

    >
    > >>>news:...

    >
    > >>> > Hello can someone assist me...

    >
    > >>> > I've added twocheckboxes to my page

    >
    > >>> > <asp:CheckBox ID="ChkYes" runat="server" Text="Yes" /><br />
    > >>> > <asp:CheckBox ID="ChkNo" runat="server" Text="No" /

    >
    > >>> > I have a stored procedure set up to enter in the Yes or No answer.
    > >>> > How do I set that up on the code behind page?

    >
    > >>> > This is what I have thus far, all of the other data on the page is
    > >>> > going into the database now I just need to add thecheckboxvalue.

    >
    > >>> > The two fields in the Database are called DisplayedQues and
    > >>> > NonDisplayedQues

    >
    > >>> > Dim question As String = TxtQuestion.Text
    > >>> > Dim answer As String = TxtAnswer.Text

    >
    > >>> > Dim conn As New Data.SqlClient.SqlConnection("Data
    > >>> > Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
    > >>> > Info=True;User ID=EDCSFAQUser;Password=fax")

    >
    > >>> > Dim cmd As New Data.SqlClient.SqlCommand
    > >>> > With cmd
    > >>> > .Connection = conn 'the connection
    > >>> > .CommandType = Data.CommandType.StoredProcedure
    > >>> > .CommandText = "EnterAdminQuestion"
    > >>> > .Parameters.AddWithValue("@topicid",
    > >>> > CInt(DropDownList1.SelectedItem.Value))
    > >>> > .Parameters.AddWithValue("@quesdate", QuesDate.Text)
    > >>> > .Parameters.AddWithValue("@questions", TxtQuestion.Text)
    > >>> > .Parameters.AddWithValue("@Answer", TxtAnswer.Text)
    > >>> > .Parameters.AddWithValue("@DisplayedQues", what do I put here???)
    > >>> > .Parameters.AddWithValue("@NonDisplayedQues", what do I put here???)

    >
    > >>> > Thanks so much.- Hide quoted text -

    >
    > >>> - Show quoted text -

    >
    > >> Thanks for assisting me I'm all set but have another question...

    >
    > >> I have a field in this same database called CDPPin. I'm using a
    > >> session variable to get the pin. How do I call it? Do I...

    >
    > >> Dim Session (CDPUser)

    >
    > >> Then call it like this?

    >
    > >>> .Parameters.AddWithValue("@DisplayedQues", displayedQues)
    > >>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
    > >> . Parameters.AddWithValue("@CDPPin", CDPPin)?- Hide quoted text -

    >
    > - Show quoted text -


    Thanks so much with you assistance. Just getting back from vacation.
     
    JJ297, Aug 6, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mit
    Replies:
    1
    Views:
    836
    Ramu Pulipati
    Jan 25, 2006
  2. =?Utf-8?B?QW5nZWw=?=

    COMBO BOX INSTEAD OF DROP DOWN BOX

    =?Utf-8?B?QW5nZWw=?=, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    639
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  3. Gnarlodious
    Replies:
    4
    Views:
    17,682
    elizas
    May 5, 2010
  4. Jim

    Check box and text box disable

    Jim, Jun 3, 2004, in forum: Javascript
    Replies:
    3
    Views:
    129
    Randy Webb
    Jun 4, 2004
  5. babu17
    Replies:
    1
    Views:
    148
Loading...

Share This Page