SQL Connection using a Class in C# – Programming, Pseudocode Example, C# Programming Example
C# Windows Form

SQL Connection using a Class in C#

In this example, we’ll learn CRUD Operations in C# Windows Application using Class.

Step 1:

How to connect database from Windows application?

We will add database connection easily in windows application in simple steps as shown below,

Go to Tools menu > Click “Connect to Database”.

Step 2:

By default, the data source is selected as Microsoft SQL Server (SQL Client).

Provide “Server name” to . or localhost. and Select our database in the dropdown as “Northwind“.

Step 3:

Once the database connection is created, then you will see the connection details as shown below,

Step 4: Form Design

Step 5: Create Product.cs and ProductDal.cs

Step 6: Product.cs

Step 7: ProductDal.cs

Step 8: Form1.cs


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: