Initially, you can try something like this and develop on it:
//using System.Web.UI.HtmlControls;
var searchValue = "somethingYouSearchFor" ;
var connection = new SqlConnection("connection string here");
var query = new SqlCommand("SELECT Name, Country FROM MyTable WHERE value3 = @SearchValue", connection);
query.Parameters.AddWithValue("@SearchValue", searchValue);
connection.Open();
SqlDataReader reader = query.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
var addDiv = new HtmlGenericControl("div");
addDiv.ID = "anyId"; //Optional
addDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Yellow"); //Optional
addDiv.Style.Add(HtmlTextWriterStyle.Color, "Black"); //Optional
addDiv.Style.Add(HtmlTextWriterStyle.Height, "200px"); //Optional
addDiv.Style.Add(HtmlTextWriterStyle.Width, "300px"); //Optional
var nameLabel = new HtmlGenericControl("label");
nameLabel.InnerText = reader["Name"];
addDiv.Controls.Add(nameLabel);
var countryLabel = new HtmlGenericControl("label");
countryLabel.InnerText = reader["Country"];
addDiv.Controls.Add(countryLabel);
this.Controls.Add(addDiv);
}
}
connection.Close();
reader.Close();
query.Dispose();
It could be the simplest way to access the database, you need to fill connection string (using this link you can see several examples including the MS SQL connection string).
You need to provide a valid SQL query that matches your database (The good practice is to test your SQL query in MS SQL Studio aka SSMS) and then implement it in C# code.