If you want to communicate your database from your application c#code then you can take ADO.net(.NET framework component for data access) help. There are so many classes are there two access database. For example SqlConnection, SqlCommand, SqlDataReader, SqlDataAdapter etc for Sql Server specific component. Code sample as follows:
string connectionString = "Data Source=192.168.1.4; Initial Catalog=your_databaseName; User Id=sa; Password=****";
using(var conn = new System.Data.SqlClient.SqlConnection(connectionString))
{
using(System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT Id, Name FROM MyTable";
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
System.Data.SqlClient.SqlDataReader dataReader = cmd.ExecuteReader();
}
}
connectionString is the actual database path where your database is located and authentication information.
From your client side javascript function you can not access database directly. If you need so then you can write webserivice/wcf/webapi and then from your javascript function you will call that webservice with ajax calling.