Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Check box (http://www.velocityreviews.com/forums/t525238-check-box.html)

JJ297 07-27-2007 04:13 PM

Check box
 
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\) 07-27-2007 04:34 PM

Re: Check box
 
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" <nc297@yahoo.com> wrote in message
news:1185552806.278219.7410@q75g2000hsh.googlegrou ps.com...
> 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 07-27-2007 06:07 PM

Re: Check box
 
On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> 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!
> ************************************************"J J297" <nc...@yahoo.com> wrote in message
>
> news:1185552806.278219.7410@q75g2000hsh.googlegrou ps.com...
>
>
>
> > 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 07-27-2007 08:46 PM

Re: Check box
 
Dim CDPPin as Integer
CDPPin = CType(Session("CDPUser"), Integer)

pass CDPPin to Stored procedure.


"JJ297" <nc297@yahoo.com> wrote in message
news:1185559646.043477.35110@l70g2000hse.googlegro ups.com...
> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
> <NoSpamMgbwo...@comcast.netNoSpamM> 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!
>> ************************************************"J J297" <nc...@yahoo.com>
>> wrote in message
>>
>> news:1185552806.278219.7410@q75g2000hsh.googlegrou ps.com...
>>
>>
>>
>> > 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\) 07-27-2007 09:51 PM

Re: Check box
 
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" <sql_agentman@hotmail.com> wrote in message
news:uZkgr8I0HHA.3848@TK2MSFTNGP03.phx.gbl...
> Dim CDPPin as Integer
> CDPPin = CType(Session("CDPUser"), Integer)
>
> pass CDPPin to Stored procedure.
>
>
> "JJ297" <nc297@yahoo.com> wrote in message
> news:1185559646.043477.35110@l70g2000hse.googlegro ups.com...
>> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
>> <NoSpamMgbwo...@comcast.netNoSpamM> 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!
>>> ************************************************"J J297"
>>> <nc...@yahoo.com> wrote in message
>>>
>>> news:1185552806.278219.7410@q75g2000hsh.googlegrou ps.com...
>>>
>>>
>>>
>>> > 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 08-06-2007 02:13 PM

Re: Check box
 
On Jul 27, 5:51 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> 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!
> ************************************************"L it" <sql_agent...@hotmail.com> wrote in message
>
> news:uZkgr8I0HHA.3848@TK2MSFTNGP03.phx.gbl...
>
>
>
> > Dim CDPPin as Integer
> > CDPPin = CType(Session("CDPUser"), Integer)

>
> > pass CDPPin to Stored procedure.

>
> > "JJ297" <nc...@yahoo.com> wrote in message
> >news:1185559646.043477.35110@l70g2000hse.googlegr oups.com...
> >> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
> >> <NoSpamMgbwo...@comcast.netNoSpamM> 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!
> >>> ************************************************"J J297"
> >>> <nc...@yahoo.com> wrote in message

>
> >>>news:1185552806.278219.7410@q75g2000hsh.googleg roups.com...

>
> >>> > 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.



All times are GMT. The time now is 01:18 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.