My field is nvarchar on SQL 2000 but when i typed a name with ' i got an error, how can i avoid this error?
Printable View
My field is nvarchar on SQL 2000 but when i typed a name with ' i got an error, how can i avoid this error?
entering? or searching? for the data
First, you have to tell SQL Server to allow quoted identifier.
When inserting your data, you have to substitue each single quote with 2 single quotes:Code:Conn.Execute "SET QUOTED_IDENTIFIER ON"
Code:Conn.Execute "Insert Into MyTable (MyField) Values ('" & Replace(MyValue, "'", "''") & "')"
Entering Data, geoff_xrx
Serge: That look find, but what happen when searching?
Same thing - you just change the SQL stuff.
You have set the quoted identifier on again, before running a select statement.