Simple SQL statement and request.querystring

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gjoneshtfc@volcanomail.com

    #16
    Re: Simple SQL statement and request.queryst ring

    Aaron,

    Your help is fantastic. Problem solved straight away. I am now starting
    to understand exactly what i am doing and its down to making lots of
    mistakes and you fixing them and explaing why!

    Thanks for all your help,
    Regards, Gareth


    Aaron Bertrand [SQL Server MVP] wrote:
    [color=blue]
    > A number is not a string. You do not need ' around a price.
    >
    > And when you get to the dates, they are delimited by #.
    >
    >
    > <gjoneshtfc@vol canomail.com> wrote in message
    > news:1150910899 .845322.288040@ m73g2000cwd.goo glegroups.com.. .[color=green]
    > > Aaron,
    > >
    > > Hopefully you are still keeping an eye on this thread. I now have a
    > > similar problem but i know the reason why! I need to do the same thing
    > > but for "price" not "make". If i specify price in my database to be
    > > text and do the same thing as for make my webpage works. However, it
    > > does not bring up the correct results. When i change price in the
    > > database to number i then get the following error:
    > >
    > > Error Type:
    > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
    > > [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in
    > > criteria expression.
    > > /searchprice.asp , line 15
    > >
    > > I believe this is to do with the following line:
    > >
    > > varprice = Replace(Request .QueryString("p rice"), "'", "''" )
    > >
    > > For completeness my Recordset line is now:
    > >
    > > Recordset1.Sour ce = "SELECT * FROM MainTable WHERE [price] < '" &
    > > varprice & "' ORDER BY Price DESC"
    > >
    > > Do you have any ideas? Thanks again for all your help up to this point,
    > > Regards, Gareth
    > >[/color][/color]

    Comment

    Working...