DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 14 Aug 2007 04:59:50 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    JJ297
          2    Mark Rae [MVP]
                 3    Mick Walker
                 4    Mick Walker
                 5    Mark Rae [MVP]
          6    JJ297
          7    JJ297
          8    JJ297


Another Check box question...   
Can't get null into the database.   I'm trying to achieve...

if displayedQues = "Y" then I want nondisplayedques to go into the
database as null.  What do I need to do?  This is what I have thus
far.


Dim displayedQues As Char = "Y"
Dim nonDisplayedQues As Char = "N"


If (RadioYes.Checked) Then
            displayedQues = "Y"
        End If

 If (RadioNo.Checked)  Then
      nonDisplayedQues = "N"
        End If


Thanks for your assistance.
Date:Tue, 14 Aug 2007 04:59:50 -0700   Author:  

Re: Another Check box question...   
"JJ297"  wrote in message 
news:1187092790.022273.238830@l70g2000hse.googlegroups.com...


> What do I need to do?


Difficult to say with what you've provided so far...

Are you building up dynamic SQL (hopefuly not!), or are you using a 
paremeterised query...?


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Tue, 14 Aug 2007 13:09:34 +0100   Author:  

Re: Another Check box question...   
On Aug 14, 8:09 am, "Mark Rae [MVP]"  wrote:

> "JJ297"  wrote in message
>
> news:1187092790.022273.238830@l70g2000hse.googlegroups.com...
>
> > What do I need to do?
>
> Difficult to say with what you've provided so far...
>
> Are you building up dynamic SQL (hopefuly not!), or are you using a
> paremeterised query...?
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net


Not sure what you mean.  I have two check boxes on the design page
that ask user to select yes or no if they want their question
displayed on the FAQ sheet.

On button click I have the above code.  I wanted if the answer is yes
then put a Y in the database for Yes and Null for N.
Date:Tue, 14 Aug 2007 05:16:39 -0700   Author:  

Re: Another Check box question...   
JJ297 wrote:

> On Aug 14, 8:09 am, "Mark Rae [MVP]"  wrote:
>> "JJ297"  wrote in message
>>
>> news:1187092790.022273.238830@l70g2000hse.googlegroups.com...
>>
>>> What do I need to do?
>> Difficult to say with what you've provided so far...
>>
>> Are you building up dynamic SQL (hopefuly not!), or are you using a
>> paremeterised query...?
>>
>> --
>> Mark Rae
>> ASP.NET MVPhttp://www.markrae.net
> 
> Not sure what you mean.  I have two check boxes on the design page
> that ask user to select yes or no if they want their question
> displayed on the FAQ sheet.
> 
> On button click I have the above code.  I wanted if the answer is yes
> then put a Y in the database for Yes and Null for N.
> 

If [CheckBox].Checked = True Then
	' Do something
Else
	' Do something Else
End if
Date:Tue, 14 Aug 2007 13:19:59 +0100   Author:  

Re: Another Check box question...   
JJ297 wrote:

> On Aug 14, 8:09 am, "Mark Rae [MVP]"  wrote:
>> "JJ297"  wrote in message
>>
>> news:1187092790.022273.238830@l70g2000hse.googlegroups.com...
>>
>>> What do I need to do?
>> Difficult to say with what you've provided so far...
>>
>> Are you building up dynamic SQL (hopefuly not!), or are you using a
>> paremeterised query...?
>>
>> --
>> Mark Rae
>> ASP.NET MVPhttp://www.markrae.net
> 
> Not sure what you mean.  I have two check boxes on the design page
> that ask user to select yes or no if they want their question
> displayed on the FAQ sheet.
> 
> On button click I have the above code.  I wanted if the answer is yes
> then put a Y in the database for Yes and Null for N.
> 

Ignore my previous post. I misread your question.

You need to provide us with some of your database logic, at the moment 
your telling us nothing about how you are achiving the database insert, 
or any structure of the table concerned.
Date:Tue, 14 Aug 2007 13:21:41 +0100   Author:  

Re: Another Check box question...   
On Aug 14, 8:21 am, Mick Walker  wrote:

> JJ297 wrote:
> > On Aug 14, 8:09 am, "Mark Rae [MVP]"  wrote:
> >> "JJ297"  wrote in message
>
> >>news:1187092790.022273.238830@l70g2000hse.googlegroups.com...
>
> >>> What do I need to do?
> >> Difficult to say with what you've provided so far...
>
> >> Are you building up dynamic SQL (hopefuly not!), or are you using a
> >> paremeterised query...?
>
> >> --
> >> Mark Rae
> >> ASP.NET MVPhttp://www.markrae.net
>
> > Not sure what you mean.  I have two check boxes on the design page
> > that ask user to select yes or no if they want their question
> > displayed on the FAQ sheet.
>
> > On button click I have the above code.  I wanted if the answer is yes
> > then put a Y in the database for Yes and Null for N.
>
> Ignore my previous post. I misread your question.
>
> You need to provide us with some of your database logic, at the moment
> your telling us nothing about how you are achiving the database insert,
> or any structure of the table concerned.- Hide quoted text -
>
> - Show quoted text -


Sorry about that... here's the code behind page:

 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
        Dim question As String = TxtQuestion.Text
        Dim answer As String = TxtAnswer.Text

        Dim CDPPin As String = Session("GetPin")

        Dim displayedQues As Char = "Y"
        Dim nonDisplayedQues As Char = "N"


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

        If (RadioYes).Checked = True Then
            displayedQues = "Y"
        Else : displayedQues = ""

        End If

        If (RadioNo).Checked = True Then
            nonDisplayedQues = "N"
        Else : nonDisplayedQues = ""
        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)
            .Parameters.AddWithValue("@CDPPin", CDPPin)
        End With

        Try
            conn.Open()
            cmd.ExecuteNonQuery()

        Catch ex As Data.SqlClient.SqlException
            Throw New ApplicationException("An error occurred while
trying to insert the record")
        Finally
            conn.Close()
        End Try

        Lbloutcome.Text = "Your entry was submitted into the
database."


    End Sub
Date:Tue, 14 Aug 2007 05:31:12 -0700   Author:  

Re: Another Check box question...   
"JJ297"  wrote in message 
news:1187094672.922881.8030@g4g2000hsf.googlegroups.com...


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


If (RadioYes).Checked = True Then
    .Parameters.AddWithValue("@DisplayedQues", displayedQues)
Else
    .Parameters.AddWithValue("@DisplayedQues", System.DbNull.Value)
End If


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Tue, 14 Aug 2007 14:02:41 +0100   Author:  

Re: Another Check box question...   
On Aug 14, 9:02 am, "Mark Rae [MVP]"  wrote:

> "JJ297"  wrote in message
>
> news:1187094672.922881.8030@g4g2000hsf.googlegroups.com...
>
> >            .Parameters.AddWithValue("@DisplayedQues", displayedQues)
>
> If (RadioYes).Checked = True Then
>     .Parameters.AddWithValue("@DisplayedQues", displayedQues)
> Else
>     .Parameters.AddWithValue("@DisplayedQues", System.DbNull.Value)
> End If
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net


THANKS!
Date:Tue, 14 Aug 2007 06:28:49 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us