Re: embedded ' in strings

From: mgarner1980 (mgarner_at_kbsi.com)
Date: 07/14/04


Date: Wed, 14 Jul 2004 18:01:04 -0500

Sorry should've followed up on this one. Here's what was happening. The
field I was trying to use the where clause on was a CHAR length 6.
So let's say the user types in 123'45. My function would turn it in to
123''45. which is length 7. When I tried to execute the query I would get
the null reference exception.
So for now if there's a ' I throw it out. it's either that or truncate it to
six characters.
The thing that had me going was that the same queries worked fine insql
query analyzer for the desktop. BTW the same error also occures in th esqlce
query analyzer if you want to see what I'm talking about. It seems like a
bogus error since once the "escape" is processed, the end result should be a
string length 6.

""Brad Syputa - MS"" <bradsy@Online.Microsoft.com> wrote in message
news:j9UqnzDaEHA.3272@cpmsftngxa06.phx.gbl...
> Hi mgarner,
>
> Can you explain a little better how it throws a null reference exception?
I
> us a double single quote and it works fine for me.
>
>
> --------------------
> | From: "mgarner1980" <mgarner@kbsi.com>
> | Subject: embedded ' in strings
> | Date: Fri, 9 Jul 2004 15:24:14 -0500
> | Lines: 13
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
> | Message-ID: <u4i30KfZEHA.3092@tk2msftngp13.phx.gbl>
> | Newsgroups: microsoft.public.sqlserver.ce
> | NNTP-Posting-Host: 209.189.225.79
> | Path:
>
cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
> 8.phx.gbl!tk2msftngp13.phx.gbl
> | Xref: cpmsftngxa06.phx.gbl microsoft.public.sqlserver.ce:12805
> | X-Tomcat-NG: microsoft.public.sqlserver.ce
> |
> | I'm having problems with queries like the following in sqlserverce.
> |
> | select name from employee where lastname = 'O'Brien'
> |
> | If I use double single quote like O''Brien, that works fine on my
> sqlser2000
> | server, but throws a null reference error on sqlserverce merge
> | subscription.
> |
> | I've tried paramaterized queries with to no avail as well.
> |
> | Any ideas?
> |
> |
> |
>



Relevant Pages

  • Re: embedded in strings
    ... queries with vaues longer than the column being queried. ... I guess I could send you the sqlce database so you can test it. ... > | the null reference exception. ... > | query analyzer if you want to see what I'm talking about. ...
    (microsoft.public.sqlserver.ce)
  • Re: COM+ and ADo and performance.
    ... Change CursorLocation to clUseServer and CursorType to ctOpenForwardOnly it ... > queries and there is no more than 5-10 records at a time. ... I simply write the same query in Query Analyzer. ... But When I execute the same insert query from TClientDataSet, ...
    (borland.public.delphi.database.ado)
  • Re: iis/asp + sql2000 a bit slow
    ... > I have a performance problem, but I don't really know where the exact ... > I ran every single on of these queries with the SQL Query Analyzer, ... All queries run superfast, so I'm ...
    (microsoft.public.inetserver.asp.db)
  • Re: Is sql server as good as access 97?
    ... Once you really get into using Query Analyzer for writing your ... Transact-SQL and for formulating 'queries' for exporting to your code, ... resulting stored procedure runs in a small fraction of the time it took to ... Unfortunately the database I am converting ...
    (microsoft.public.sqlserver.programming)