ADO.NET and C# Programming Flashcards
Write a code line to add a Namespace to use SQL Server Provider.
using System.Data.SqlClient;
Name other two (2) database Providers apart from SQL Server Provider.
OracleClient
OLE DB
Name any two (2) basic components of ADO.NET.
Connection: Manages the connection to the database.
Command: Executes SQL commands against the database.
Describe a class constructor in C# programming language.
A class constructor is a special method with the same name as the class, used to initialize the object’s state when an instance of the class is created. It may take parameters, and its purpose is to set up the initial values of the class’s properties or perform other necessary setup tasks.
A class Product has properties: Code and Price. Write a code snippet for the constructor of the class Product to initialize the properties with values passed as parameters. (No need to define properties).
public class Product
{
public string Code { get; set; }
public decimal Price { get; set; }
// Constructor public Product(string code, decimal price) { Code = code; Price = price; } }
Illustrate the following class relationships with well-labeled diagrams.
i. Associations between class Manager and Class Department.
ii. Aggregation between class Engine and class Car.
iii. Generalization between class Fish and class Animal.
iv. Composition between class Department and class Company.