You need several things to be able to do what you want, which include establishing a connection from the web page to the database, using the names of the record sets or database field names to query the information in it, a good overall understanding of databases, their design and data normalisation, among other things.
A query can read from, write to or remove information in a database.
A query is a series of statements in SQL.
SQL is, to most people, Structured Query Language, although that isn't strictly the correct interpretation of the acronym, let's not split hairs, so for now we'll settle on it standing for Structured Query Language.
A simple query could be like this:
SELECT*FROM FRIENDS WHERE LAST_NAME = "Smith";
Note that the query ends with a semi-colon.
The above query, when broken into its component parts, does this:
SELECT* says that you want to Select (view) all (*)
FROM FRIENDS means that the database table you want to look in is called FRIENDS
WHERE LAST_NAME = "Smith"; is asking for any records with a last name of Smith
The whole thing reads, more or less, Select all records from table name friends where the last name is Smith. Simple really, once you have a handle on some basics.
To start with, I'd suggest you do some reading on the whole subject and since you've asked about ASP.NET I strongly suggest you try the Microsoft .NET site at click here - it is stuffed to the gills with loads of tutorials, a nice, free .NET editor, some sample applications to show you how things work, and all kinds of other things.
A kick-starter on SQL can be found click here
There is no way to post working code without knowing what your database is, its name, the tables in it and the record field names in the tables, along with a couple of other things which would be handy to know.
Post again with the code you have and some details of your database and one of us will walk you through things.