About 41,400 results
Open links in new tab
  1. SqlConnection Class (Microsoft.Data.SqlClient) | Microsoft Learn

    A SqlConnection object represents a unique session to a SQL Server data source. With a client/server database system, it is equivalent to a network connection to the server.

  2. C# - SqlConnection Example - Dot Net Perls

    Dec 24, 2024 · We use SqlConnection in a "using" statement. The SqlConnection has a constructor that requires a string reference pointing to the connection string character data.

  3. How do I connect to a SQL database from C#? - Stack Overflow

    SqlConnection documentation from Microsoft was mentioned in another answer. What is missing is that connection.Close() does not need to be called if used in the following way (example is …

  4. A Guide to Using SQLConnection in .NET | by Benedict Odoh

    Aug 10, 2025 · One of the core tools for this is SqlConnection — a class provided by ADO.NET that acts as a bridge between your application and a SQL Server database. Think of it as your …

  5. ADO.NET Core SqlConnection Class - Dot Net Tutorials

    The SqlConnection class (typically from the Microsoft.Data.SqlClient namespace) in ADO.NET Core is used to establish and manage a session with a SQL Server database.

  6. SqlConnection.Open Method (Microsoft.Data.SqlClient)

    The SqlConnection draws an open connection from the connection pool if one is available. Otherwise, it establishes a new connection to an instance of SQL Server.

  7. Exploring C# SqlConnection for Database Connections

    Aug 7, 2024 · When working with databases in C#, the SqlConnection class plays a crucial role in establishing connections to SQL Server databases. This class is part of the ADO.NET …

  8. Fixing "The type or namespace name 'SQLConnection' could not …

    6 days ago · If you’ve ever tried to connect a C# application to a SQL Server database (like an accounts database storing user credentials, transaction history, or account balances), you’ve …

  9. SQL Server Connection Strings Reference Guide

    Jan 6, 2025 · using (SqlConnection connection = new SqlConnection(conn.ConnectionString)) { //Query used in the code String sql = "SELECT CurrencyCode,Name from Sales.Currency"; …

  10. SqlConnection.ConnectionString Property (Microsoft.Data.SqlClient)

    SqlConnection properties return only those settings that are contained in the ConnectionString. To connect to a local computer, specify " (local)" for the server.