Major question: Is this code supposed to appear *ON* the page named
ccSearch.aspx? Or will it appear on some other (possibly HTML, not even ASP.NET) page?
If the former, then you need to stop what you are doing and go back and learn how to correctly use ASP.NET controls.
But if the latter...
First of all, THIS code would never work to send the ID in *ANY* system. ASP/JSP/PHP/ASP.NET or even CF:
Code:
<a ID="3" href="search/ccSearch.aspx">country link</a>
When you use an href to invoke *ANY* server-side page, the ONLY way to pass data is as part of the query string. So you *MUST* do something like
Code:
<a href="search/ccSearch.aspx?ID=3">country link</a>
(And in any case an HTML id="..." starting with a digit is not supported in many ways.)
For
Code:
<a href="search/ccSearch.aspx?countryName=mycountry&countryID=2">
you can use
Request.QueryString("countryName") to retrieve the value in the query string.
So you could just use
Code:
<% Response.Write( Request.QueryString("countryName") ) %>
(needs a terminating semicolon of you are writing in C# instead of VB.NET).
But there are many many better ways to do this with ASP.NET. And the only way you are going to learn them is to start with a *GOOD* ASP.NET tutorial and work through all the examples.
Same, especially, applies to using a database with ASP.NET. There are so many ways to do so that I can't possibly go into all of them here.
The simplest would be
Code:
' VB.Net
Dim SQL As String = "SELECT * FROM myDatabase WHERE myDatabaseID=" & Request.QueryString("id")
' C#
String SQL = "SELECT * FROM myDatabase WHERE myDatabaseID=" + Request.QueryString("id");
But odds are that's not what you are going to ultimately want to do. Again, go find a tutorial and start working through *ALL* the examples.
ASP.NET is enormously flexible and yet, at the same time, there are some rigid rules that will help you use it in the best ways. ASP.NET has a steep learning curve, compared to CF or PHP, but the end result is worth it. But you must spend the time to REALLY learn it if you expect to get good results from it.