How to Integrate Edge AI with Other Technologies in 2025
In 2025, the fusion of advanced technologies is not just an option—it’s a necessity. Among these, Edge AI is leading the charge, offering businesses the ability to process and act […]
Creating a database connection string from app.config is a very common practice used in C# windows based application. Watch the below video or follow the simple steps to make connection with database in C# window based application using App.config file.
Step1. Open Visual Studio and create a new Windows application. (Path : Start -> All Programs -> Microsoft Visual Studio 2010-> Microsoft Visual Studio 2010)
Step2. Add a new Application Configuration file App.config file to the project.
Step3. Provide the connection string name, database name and system related information in the App.config file.
<configuration>
<connectionStrings>
<add name=”customConnection” connectionString=”Data Source=Custom-PC;Initial Catalog=customDB;User Id=sa;Password=” providerName=”System.Data.SqlClient”/>
</connectionStrings>
</configuration>
Step4. Making a separate connection class.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
namespace customproject
{
public class Class_custom
{
public SqlConnection con ;
public SqlCommand cmd;
public Class_custom()
{
con = new SqlConnection(ConfigurationManager.ConnectionStrings[“customConnection “].ConnectionString);
con.Open();
cmd = new SqlCommand();
cmd.Connection = con;
}
}
}
Using above code, the user can make connection with database in a C# window using App.config file.
You may be interested in:
Jan 2nd, 2025
In 2025, the fusion of advanced technologies is not just an option—it’s a necessity. Among these, Edge AI is leading the charge, offering businesses the ability to process and act […]
Dec 12th, 2024
Technology is advancing at an unprecedented pace, reshaping industries and redefining the roles of professionals. As we approach 2025, staying ahead of the curve requires understanding emerging trends and their […]
Dec 10th, 2024
As 2024 comes to a close, it’s the perfect time to reflect on the remarkable technological innovations that have shaped the year. From advancements in Artificial Intelligence (AI) to the […]