ADO.NET CRUD – C# Code Typing Test
Demonstrates basic ADO.NET CRUD operations using SqlConnection, SqlCommand, and SqlDataReader.
Part of the .NET Centric Computing with C# syllabus · Unit 5: Working with Database
- Lines
- 68
- Chars
- 1,275
- At 40 WPM
- ≈ 6m 23s
Mode:
Duration:
0s0wpm100%
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using Microsoft.Data.SqlClient;
class Program
{
static string connectionString = "your_connection_string_here";
static void Main()
{
CreateRecord();
ReadRecords();
UpdateRecord();
DeleteRecord();
}
static void CreateRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "INSERT INTO Students (Name, Age) VALUES ('Alice', 20)";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
static void ReadRecords()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "SELECT * FROM Students";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["Name"] + " - " + reader["Age"]);
}
}
}
static void UpdateRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "UPDATE Students SET Age = 25 WHERE Name = 'Alice'";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
static void DeleteRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "DELETE FROM Students WHERE Name = 'Alice'";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
}Coding works best on desktop or with an external keyboard.
tab→enterrestart test
✦This snippetADO.NET CRUD — C# Code
Demonstrates basic ADO.NET CRUD operations using SqlConnection, SqlCommand, and SqlDataReader.
using System;
using Microsoft.Data.SqlClient;
class Program
{
static string connectionString = "your_connection_string_here";
static void Main()
{
CreateRecord();
ReadRecords();
UpdateRecord();
DeleteRecord();
}
static void CreateRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "INSERT INTO Students (Name, Age) VALUES ('Alice', 20)";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
static void ReadRecords()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "SELECT * FROM Students";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["Name"] + " - " + reader["Age"]);
}
}
}
static void UpdateRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "UPDATE Students SET Age = 25 WHERE Name = 'Alice'";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
static void DeleteRecord()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
string query = "DELETE FROM Students WHERE Name = 'Alice'";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
}
}
}✦Language file
C# Language Guide
C# (C-Sharp) is a modern, object-oriented, multi-paradigm programming language built by Microsoft for the .NET platform. It is designed for productivity, type safety, performance, and building scalable applications across desktop, web, mobile, gaming, and cloud systems.
- Origin & Creator
- Created by Anders Hejlsberg at Microsoft in 2000 as part of the .NET platform. Evolved significantly with versions introducing LINQ, async/await, records, pattern matching, and high-performance features in modern .NET.
- Industrial Note
- C# dominates Windows development, enterprise CRM/ERP systems, Unity-powered games, Azure cloud apps, and scalable backend systems. It is widely chosen for large corporate software ecosystems, cloud-native microservices, and cross-platform applications through .NET Core.
Primary Use Cases
- Enterprise backend systems
- Web APIs (ASP.NET Core)
- Unity game development
- Desktop software (WPF/WinUI)
- Cloud-native microservices on Azure
- Cross-platform mobile apps (MAUI/Xamarin)
Notable Features
- Strongly-typed OOP design
- Async/await built-in
- LINQ for querying data
- Cross-platform runtime via .NET Core
- Modern functional programming features
- Powerful tooling with Visual Studio
Quick Explain
- C# compiles to IL (Intermediate Language) and runs on the .NET CLR.
- Supports OOP, functional programming, asynchronous programming, and modern language abstractions.
- Used for enterprise apps, web APIs, Unity game development, cloud-native apps, and Windows desktop systems.
Core Features
- CLR runtime and IL execution
- Classes, structs, interfaces, records
- Generics and type inference
- LINQ for data querying
- Async/await for concurrency
Learning Path
- Learn C# basics & OOP
- Master LINQ and collections
- Learn async/await
- Learn ASP.NET Core or Unity
- Build real projects
Practical Examples
- Build REST APIs with ASP.NET Core
- Create cross-platform mobile apps with MAUI
- Develop games with Unity
- Build cloud services using Azure functions
Comparisons
- More structured than JavaScript
- More enterprise-ready than PHP
- Faster development cycle than Java
- Higher-level than Go or Rust
Strengths
- Excellent tooling and developer productivity
- High performance with modern .NET
- Strong type safety
- Great for enterprise systems
- Massive ecosystem (ASP.NET, Unity, MAUI)
Limitations
- Heavily tied to Microsoft ecosystem historically
- Slightly more complex runtime model
- Not ideal for low-level systems
- Unity uses older C# versions at times
When NOT to Use
- Ultra-low level systems (use Rust/C++)
- High-performance bare-metal apps
- Small throwaway scripts (Python fits better)
- Legacy systems expecting JVM or C
Cheat Sheet
- Basic C# syntax
- LINQ operators
- Async patterns
- ASP.NET routing & attributes
FAQ
- Is C# still relevant?
- Yes - it powers enterprise apps, Unity games, and modern cloud systems.
- Is C# beginner friendly?
- Very - its syntax is clean and expressive.
- Is C# good for high performance?
- Yes - modern .NET rivals Java and Go in performance.
- Why choose C#?
- Strong tooling, cross-platform support, performance, and large ecosystem.
30-Day Skill Plan
- Week 1: OOP + delegates + LINQ
- Week 2: Async programming
- Week 3: ASP.NET Core
- Week 4: EF Core + Cloud deployment
Final Summary
- C# is a powerful, productive, enterprise-friendly language.
- Ideal for web APIs, games, cloud services, and desktop apps.
- Modern .NET delivers high performance and cross-platform runtime.
- Long-term career value with massive corporate demand.
Project Structure
- Program.cs / Startup.cs
- Controllers/Services folders (for APIs)
- appsettings.json
- csproj project file
- bin/obj build directories
Monetization
- Enterprise .NET developer jobs
- Unity game development
- Azure cloud engineering
- Freelancing ASP.NET projects
Productivity Tips
- Use Visual Studio shortcuts
- Use records & init setters
- Use global usings
- Use LINQ effectively
Basic Concepts
- Variables, data types
- Classes, structs, interfaces
- OOP principles
- Delegates, events, lambdas
- LINQ and collections
- Async/await concurrency
Official Docs
- Microsoft C# Documentation
- .NET Runtime Documentation
- ASP.NET Core Docs