JP SIngh wrote:
In one of our applications we have product id field which sometime
contains '
When doing a search the sql breaks due to this. I cannot use replace
function to remove this is there anything else I can do so that this
works
strProductId = 2277'778
sqlstr = " Select * from productdetails where id ='" & strProductId &
"'"
In this instance the sql breaks and gives me an error. Any
suggestions how i can solve this
Regards
The easiest thing to do would be to use a saved parameter query if you are
using Access (look for posts by me containing those keywords), or a stored
procedure if you are using SQL Server.
Why can't you use Replace? It would look like this:
sqlstr = " Select * from productdetails where id ='" & _
Replace(strProductId,"'","''") & "'"
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"