Get data as variable for SQL query in ASP.net

liunx

Guest
Hey guys, I am trying to migrate over to ASP.net (my background is PHP). Making a learning test website, but I don't know how to reference the get data as a variable in my code either in the SQL query, or in a link that is pointing somewhere else.

Could anyone help me out?

Ex. <!-- m --><a class="postlink" href="http://test.com/test.aspx?Testget=1">http://test.com/test.aspx?Testget=1</a><!-- m -->

sqlame="SELECT Test from Tests where Test = Testget"myCSharpStringVar = Request["Testget"];

I believe in VB.Net you replace the brackets with parens and drop the ";"

Once you sanitize it you can use it in the sql just like any other string, such as:

sqlame = "select Test from Tests where Test = " + myCSharpStringVar;

again for VB.Net I believe you drop the ";" and replace the "+" with "&"

I hope this answers your questions because I'm not sure I understood it :)
 
Back
Top