SQL string does not recognize querystrings in c#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • .Net Sports

    #1

    SQL string does not recognize querystrings in c#

    I have an sql string in a C# script:
    "SELECT d.salesrep_id FROM tblDeal as d WHERE d.orderdate = '" &
    request.queryst ring("boarddate ") & "';";

    ....but I can't use request.queryst ring because it is vb.net . Is there
    a comparable statement in c# that works?
    thanks
    ..NetSports

  • arunprakashb@gmail.com

    #2
    Re: SQL string does not recognize querystrings in c#

    Request.QuerySt ring["boarddate"] should work fine.. or did i
    misunderstand ur question?

    BTW, the objects in .Net are not bound to a language, only language
    features, keywords are (language interoperabilit y).

    -----------
    Arun Prakash. B

    Comment

    • .Net Sports

      #3
      Re: SQL string does not recognize querystrings in c#

      The error i get is:
      The type or namespace name 'request' could not be found (are you
      missing a using directive or an assembly reference?)

      ....so for some reason, it doesnt pick up the term "request " as any
      type of keyword, class, or object (???)

      ..netSports

      Comment

      • KH

        #4
        Re: SQL string does not recognize querystrings in c#

        C# is case sensitive -- Request.QuerySt ring["whatever"]

        BTW you may want to consider using parameterized queries instead of building
        them like that -- Search MSDN and/or Google for SQL Injection Attacks


        ".Net Sports" wrote:
        [color=blue]
        > The error i get is:
        > The type or namespace name 'request' could not be found (are you
        > missing a using directive or an assembly reference?)
        >
        > ....so for some reason, it doesnt pick up the term "request " as any
        > type of keyword, class, or object (???)
        >
        > ..netSports
        >
        >[/color]

        Comment

        • Landi

          #5
          Re: SQL string does not recognize querystrings in c#

          Use stored procedures and pass them as parameters.

          --
          info@donotspam dowhileloop.com
          http://www.dowhileloop.com web development
          http://publicjoe.dowhileloop.com -- C# & VB.NET Tutorials
          "KH" <KH@discussions .microsoft.com> wrote in message
          news:F9C54887-E2B6-4E23-A063-2FF82FC9C51D@mi crosoft.com...[color=blue]
          > C# is case sensitive -- Request.QuerySt ring["whatever"]
          >
          > BTW you may want to consider using parameterized queries instead of[/color]
          building[color=blue]
          > them like that -- Search MSDN and/or Google for SQL Injection Attacks
          >
          >
          > ".Net Sports" wrote:
          >[color=green]
          > > The error i get is:
          > > The type or namespace name 'request' could not be found (are you
          > > missing a using directive or an assembly reference?)
          > >
          > > ....so for some reason, it doesnt pick up the term "request " as any
          > > type of keyword, class, or object (???)
          > >
          > > ..netSports
          > >
          > >[/color][/color]


          Comment

          Working...