Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Check box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ297 - 27 Jul 2007 17:13 GMT
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) - 27 Jul 2007 17:34 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.