Re: How do I preserve carriage returns in SQL?
From: Joseph Geretz (jgeretz_at_nospam.com)
Date: 03/21/05
- Next message: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Previous message: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- In reply to: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Next in thread: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Reply: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Mar 2005 13:42:59 -0500
Hi Dan,
Thanks for your reply. You are absolutely correct. We are submitting the SQL
through the ADO Connection.Execute method. However, I did find a bit of code
which was replacing vbCrLf with " ". Duh! :-)
Anyway, with that out of the way, I'm finding that the data makes its way
into the table complete with carriage returns. Or more precisely, complete
with line feeds. I'm finding on the retrieval side that I need to execute
the following string replacement in order for the data to display correctly
in a multi-line textbox.
RS("Alert") = Replace(RS("Alert"), vbLf, vbCrLf)
I'm guessing that if I'd be writing this to the table via a Recordset this
wouldn't be an issue. This is the way most of our database updates are
applied and I've never noticed carriage returns to be an issue. However,
since we're doing this particular update via embedded SQL it seems that
line-breaks go into the database as the vbLf character, while a vbCrLf is
needed in order to properly display a newline in a textbox.
Does this sound correct?
Thanks for your help,
- Joe Geretz -
"Daniel Crichton" <msnews@worldofspack.co.uk> wrote in message
news:%23pSwBZjLFHA.3844@TK2MSFTNGP14.phx.gbl...
> Joseph wrote on Mon, 21 Mar 2005 10:44:29 -0500:
>
>> How do I preserve carriage returns in my SQL statement? See the update
>> statement below. The value for the Alert field is:
>>
>> 'Alert1
>> Alert2
>> Alert3
>> Alert4'
>>
>> However, when I read this back from the database, I get 'Alert1 Alert2
>> Alert3 Alert4'. I guess I could convert vbCRLF to '|' and vice versa when
>> I get the data back from the database. But this would eliminate the pipe
>> character as a legal data character. Is there a more standard approach?
>>
>> Thanks for your help!
>>
>> - Joe Geretz -
>>
>> UPDATE PERSONALERTS
>> SET ALERTID = 1,
>> ISPRIVATE = 'N',
>> ISDELETED = 'N',
>> CREATEDBY = 1,
>> CREATETIME = '03/21/2005 10:36',
>> MODIFIEDBY = NULL,
>> MODIFYTIME = NULL,
>> DELETEDBY = NULL,
>> DELETETIME = NULL,
>> ALERT = 'Alert1
>> Alert2
>> Alert3
>> Alert4'
>> WHERE PERSONID = 9367
>>
>
> How are you sending this SQL statement to your server? I've just tried
> something similar on mine in SQL Query Analyzer and it stores and returns
> the line breaks fine.
>
> Dan
>
>
>
>
>
- Next message: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Previous message: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- In reply to: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Next in thread: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Reply: Daniel Crichton: "Re: How do I preserve carriage returns in SQL?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|