Hi,
Using asp.net 1.1 and
vb.net I have a form that a user updates and their details are written to a database. One validation check I want to add is to ensure any quotation marks are removed from the entry before this is written to the database.
Within the Submit button sub procedure that updates the data into the database I have used the following coded examples :
1. txtInput.Text.Replace("'", "''")
OR
2. txtInput.Text = txtInput.Text.Replace("'", "''")
However these are not removing the quotation marks. No error is produced but the quotation marks are entered into the database. Any ideas why this is not working. Here's where I'm using the code :
Code:
Sub btnSubmit_Click(sender As Object, e As EventArgs)
'txtInput.Text.Replace("'", "''") - 1st attempt
txtInput.Text = txtInput.Text.Replace("'", "''") - 2nd attempt
'Calls function to update database
UpdateDB(txtInput.Text)
'Confirmation message
Response.Write("Details submitted - thanks")
End Sub