You can Google out for the "different ways" and they will return a bunch of results for you. I don't know many of them, but one is the default ASP.NET way of doing it. Otherwise you can use the .NET method.
ASP.NET way
In ASP.NET way you use the
Database class[
^] of the WebMatrix.Data namespace. The example code is,
var db = Database.Open("databaseName");
var selectQuery = "SELECT * FROM table_name";
var result = db.Query(selectQuery);
.NET way
In .NET you can use the
System.Data.SqlClient[
^] namespace to work with the Databases. It exposes many classes and methods to work with the SQL server. You can use them to manipulate the data in your SQL server. Connection Strings are used to connect to the database (or the server).
using (SqlConnection conn = new SqlConnection("connectionString")) {
conn.Open();
}
This .NET method can be understood from my article. Please have a look at
this article[
^].