"ConnectionStrings": {
"connection": "data source = DESKTOP-B8SJS28; initial catalog = test7523; trusted_connection = true; TrustServerCertificate=true"
},
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: false);
IConfiguration configuration = builder.Build();
string constring = configuration.GetValue<string>("ConnectionStrings:connection");
string kk = "";
using (SqlConnection con = new SqlConnection(constring))
{
con.Open();
SqlCommand cmd = new SqlCommand("get_record", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
con.Close();
kk = JsonConvert.SerializeObject(dt);
//var response = Request.CreateResponse(HttpStatusCode.OK);
//response.Content = new StringContent(kk, System.Text.Encoding.UTF8, "application/json");
}
return kk;
"Data Source=SQL8005.site4now.net;Initial Catalog=db_a96a36_test;User Id=db_a96a36_test_admin;Password=AKas@#123"