SQL string does not recognize querystrings in c#

  • Thread starter Thread starter .Net Sports
  • Start date Start date
N

.Net Sports

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

....but I can't use request.querystring because it is vb.net . Is there
a comparable statement in c# that works?
thanks
..NetSports
 
Request.QueryString["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 interoperability).
 
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
 
C# is case sensitive -- Request.QueryString["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
 
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 said:
C# is case sensitive -- Request.QueryString["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 said:
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
 
Back
Top