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

Signature
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!
************************************************
> Hello can someone assist me...
>
[quoted text clipped - 33 lines]
>
> Thanks so much.
JJ297 - 27 Jul 2007 19:07 GMT
On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> Dim displayedQues as Boolean = False
> Dim nonDisplayedQues as Boolean = False
[quoted text clipped - 67 lines]
>
> - 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 - 27 Jul 2007 21:46 GMT
Dim CDPPin as Integer
CDPPin = CType(Session("CDPUser"), Integer)
pass CDPPin to Stored procedure.
> On Jul 27, 12:34 pm, "Cowboy \(Gregory A. Beamer\)"
> <NoSpamMgbwo...@comcast.netNoSpamM> wrote:
[quoted text clipped - 86 lines]
>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
> . Parameters.AddWithValue("@CDPPin", CDPPin)?
Cowboy (Gregory A. Beamer) - 27 Jul 2007 22:51 GMT
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.

Signature
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!
************************************************
> Dim CDPPin as Integer
> CDPPin = CType(Session("CDPUser"), Integer)
[quoted text clipped - 91 lines]
>>> .Parameters.AddWithValue("@NonDisplayedQues", nonDisplayedQues)
>> . Parameters.AddWithValue("@CDPPin", CDPPin)?
JJ297 - 06 Aug 2007 15:13 GMT
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.
[quoted text clipped - 104 lines]
>
> - Show quoted text -
Thanks so much with you assistance. Just getting back from vacation.