I'm working on a database for a list of users and have an import function that reads lines from an Excel file then builds a SQL statement to insert the data into the table. In one of my test runs one of the users had a single quote in their name and messed up the SQL. Here's a snippet of my SQL statement. The variable are all Strings, so as far as I know they need the single quotes around them. Thus if a user has a single quote in their name it throws off the SQL. Is there any way to cleanse the data or get SQL to ignore the quote in the name?
Code:
strSQL = "INSERT INTO [AmadeusUsers] ([Status],[FirstName],[MiddleName],[LastName]) "
strSQL = strSQL + "VALUES ('" & Status & "','" & FirstName & "','" & MiddleName & "','" & LastName & "')"
Comment