This is a simple console application developed using C# and .NET 8. Its purpose is to connect directly to a Microsoft SQL Server database and execute raw SQL queries.
I developed this project to practice the fundamentals of the ADO.NET (Microsoft.Data.SqlClient) library, without relying on an ORM (Object-Relational Mapper) like Entity Framework.
- Connects to an MS SQL Server using a standard connection string.
- Waits for the user to input an SQL query (within a continuous loop).
- If the query starts with
SELECT, it dynamically detects the column names and rows from the returned data and prints them to the console as a table. - If the query is
INSERT,UPDATE, orDELETE, it informs the user of the number of rows affected by the operation. - It catches potential errors from the database (e.g., incorrect syntax) and displays them in the console.
- Language: C#
- Platform: .NET 8 (Console Application)
- Database Library: ADO.NET (Microsoft.Data.SqlClient)
- Tested On: Microsoft SQL Server 2022 Developer Edition
- Clone or download this repository.
- Open the
QueryTerminal.slnfile with Visual Studio 2022. - Important: Before running the project, you must update the
connectionStringvariable in theProgram.csfile to match your own local SQL Server and test database (like ourTestDB). - Press F5 or the "Start" button to run the application.
Mehmet İkbal Kahraman - Portfolio Project.