On Aug 14, 8:21 am, Mick Walker <materiali...@privacy.netwrote:
JJ297 wrote:
On Aug 14, 8:09 am, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"JJ297" <nc...@yahoo.comwrote in message
>news:11**********************@l70g2000hse.googleg roups.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