Putting Text with Apostrophe into SQL Server Memo Field 
Author Message
 Putting Text with Apostrophe into SQL Server Memo Field

Typically, I update or insert new records to SQL tables in VB using the
following statements:

    Set dbMyDB = OpenDatabase ("MyDB", false, false, ConnectString)
    retval = dbMyDB.ExecuteSQL(SQLCommandString)

where SQLCommandString would be something like

" UPDATE MyTable SET MyTextField = 'Some String'  "

or

" INSERT INTO MyTable (MyTextFIeld), VALUES('Some Text Value') "

This usually works fine. But there is a problem if MyField is a text or
memo field and the <value of myfield> which is to be updated contains
the apostrophe character(s). The reason, of course, is that SQL Commands
in MS SQL Server use the apostrophe character to enclose text values.

Does this mean that I can't put apostrophe characters into an SQL text
field, or is there some trick to get this done?

Thanks for help.



Wed, 24 Dec 1997 03:00:00 GMT  
 Putting Text with Apostrophe into SQL Server Memo Field

Quote:

>Typically, I update or insert new records to SQL tables in VB using the
>following statements:
>    Set dbMyDB = OpenDatabase ("MyDB", false, false, ConnectString)
>    retval = dbMyDB.ExecuteSQL(SQLCommandString)
>where SQLCommandString would be something like
>" UPDATE MyTable SET MyTextField = 'Some String'  "
>or
>" INSERT INTO MyTable (MyTextFIeld), VALUES('Some Text Value') "
>This usually works fine. But there is a problem if MyField is a text or
>memo field and the <value of myfield> which is to be updated contains
>the apostrophe character(s). The reason, of course, is that SQL Commands
>in MS SQL Server use the apostrophe character to enclose text values.
>Does this mean that I can't put apostrophe characters into an SQL text
>field, or is there some trick to get this done?

I always go through my 'Some String' first, and replaces all
occurences of ' with ?.

Dag.



Thu, 25 Dec 1997 03:00:00 GMT  
 Putting Text with Apostrophe into SQL Server Memo Field

Quote:

>Typically, I update or insert new records to SQL tables in VB using the
>following statements:
>    Set dbMyDB = OpenDatabase ("MyDB", false, false, ConnectString)
>    retval = dbMyDB.ExecuteSQL(SQLCommandString)
>where SQLCommandString would be something like
>" UPDATE MyTable SET MyTextField = 'Some String'  "
>or
>" INSERT INTO MyTable (MyTextFIeld), VALUES('Some Text Value') "
>This usually works fine. But there is a problem if MyField is a text or
>memo field and the <value of myfield> which is to be updated contains
>the apostrophe character(s). The reason, of course, is that SQL Commands
>in MS SQL Server use the apostrophe character to enclose text values.
>Does this mean that I can't put apostrophe characters into an SQL text
>field, or is there some trick to get this done?
>Thanks for help.

Search through "Some Text Value",first, and replace ' with ?

ackward, and not exact in searches,  but it works...

Dag.



Thu, 25 Dec 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Apostrophe in memo field

2. ODBCDirect Problem with SQL Server Memo/Picture Fields

3. SQL Server and Memo Fields

4. RichText, Memo Field, and SQL Server 2000

5. Entering vast amont of text into memo-field of access-database (on server)

6. Text/Memo Fields in SQL 6.5

7. SQL Searching For Text in Memo Fields with Binary Data Included

8. Insert Text into a memo field using SQL

9. Loading Rich Text Box from SQL Server 6.5 Text Field

10. Append memo field to a different memo field

11. Memo fields - problems reporting 2 memo fields

12. DBGrid....how to put a Memo field on a DbGRID (by using Carriage return)

 

 
Powered by phpBB® Forum Software