Carl Thomas
8/13/2007 2:39:00 PM
Actually, I misspoke - I did try the parameter approach, but it didn't help.
Maybe I was using them wrong, but separating the read operations from one
database and the write operations into a second one through an intermediate
array worked. If it was slightly less elegent and complex, it worked. I'll
give the parametric approach another go to help trim the code a bit.
Carl
"Carl Thomas" <carlmthomas@windstream.net> wrote in message
news:uzFLdWS3HHA.5240@TK2MSFTNGP02.phx.gbl...
>I haven't tried SqlParameters since I found a work around. I may give it a
>try since my solution was less elegent than I'd like (see my reply to Kerry
>Moorman's post). Somehow, I've never gotten around to SqlParameters, but
>it might be a nice application to try.
>
> Thanx.
>
> Carl
>
> "Morten Wennevik" <MortenWennevik@hotmail.com> wrote in message
> news:op.twwpsdsdklbvpo@ubuan...
>> On Sat, 11 Aug 2007 18:02:02 +0200, Carl Thomas
>> <carlmthomas@windstream.net> wrote:
>>
>>> I have names in a data collection the include apostrophes like O'Hare.
>>> When
>>> I use a simple VC#/ADO.NET approach with an SQL INSERT statement and
>>> cmd.ExecuteNonQuery, it always hangs up on the apostrophe saying that
>>> there
>>> is an unterminated string. When I try using a DataAdapter and
>>> SqlCommandBuilder, it says I need and INSERT statement, although it will
>>> do
>>> data without the apostrophes. Any idea how to handle these cases?
>>> I've
>>> also tried parameters, but the results are the same.
>>>
>>> TIA
>>>
>>> Carl
>>>
>>>
>>>
>>
>> Carl, use SqlParameter to pass the data. Saves you all these kinds of
>> troubles.
>>
>> --
>> Happy coding!
>> Morten Wennevik [C# MVP]
>
>