S
si_owen
Hi all,
I have a SQL query that worked fine in my project until it came to
testing. I found that the NvarChar fields I have wont accept the use of
an '
My code and query is here does anyone know how to change the query to
accept an ' whilst keeping the data true.
Dim dbConn2 As SqlConnection = New
SqlConnection(dataQuestions.ConnectionString)
Dim NewQuestion As String = Question.Text
Dim NewAnswer As String = Answer.Text
Dim QuestionID As Integer = CInt(List1.SelectedValue)
Dim CategoryID As Integer = CInt(Category2.SelectedValue)
dbConn2.Open()
Dim strSQL As String = "UPDATE [faq questions] SET question
= '" & NewQuestion & "', answer = '" & NewAnswer & "', categoryID = " &
CategoryID & " where questionID = " & QuestionID
----------------------------------------------------------------------------------------------------------------------------------------------
I have also tried using brackets as below but this again causes the
program to crash...
Dim strSQL As String = "UPDATE [faq questions] SET question
= " & NewQuestion & "[, answer = " & NewAnswer & "][, categoryID = " &
CategoryID & "] where questionID = " & QuestionID
any help would be much appreceiated,
Simon
I have a SQL query that worked fine in my project until it came to
testing. I found that the NvarChar fields I have wont accept the use of
an '
My code and query is here does anyone know how to change the query to
accept an ' whilst keeping the data true.
Dim dbConn2 As SqlConnection = New
SqlConnection(dataQuestions.ConnectionString)
Dim NewQuestion As String = Question.Text
Dim NewAnswer As String = Answer.Text
Dim QuestionID As Integer = CInt(List1.SelectedValue)
Dim CategoryID As Integer = CInt(Category2.SelectedValue)
dbConn2.Open()
Dim strSQL As String = "UPDATE [faq questions] SET question
= '" & NewQuestion & "', answer = '" & NewAnswer & "', categoryID = " &
CategoryID & " where questionID = " & QuestionID
----------------------------------------------------------------------------------------------------------------------------------------------
I have also tried using brackets as below but this again causes the
program to crash...
Dim strSQL As String = "UPDATE [faq questions] SET question
= " & NewQuestion & "[, answer = " & NewAnswer & "][, categoryID = " &
CategoryID & "] where questionID = " & QuestionID
any help would be much appreceiated,
Simon