|
-
Feb 5th, 2002, 04:37 PM
#1
Thread Starter
Fanatic Member
The ' character
My field is nvarchar on SQL 2000 but when i typed a name with ' i got an error, how can i avoid this error?
-
Feb 5th, 2002, 04:41 PM
#2
entering? or searching? for the data
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 5th, 2002, 04:47 PM
#3
First, you have to tell SQL Server to allow quoted identifier.
Code:
Conn.Execute "SET QUOTED_IDENTIFIER ON"
When inserting your data, you have to substitue each single quote with 2 single quotes:
Code:
Conn.Execute "Insert Into MyTable (MyField) Values ('" & Replace(MyValue, "'", "''") & "')"
-
Feb 5th, 2002, 04:51 PM
#4
Thread Starter
Fanatic Member
Entering Data, geoff_xrx
Serge: That look find, but what happen when searching?
-
Feb 5th, 2002, 05:32 PM
#5
PowerPoster
Same thing - you just change the SQL stuff.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Feb 5th, 2002, 05:43 PM
#6
You have set the quoted identifier on again, before running a select statement.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|