Full Transcript

Module 1 - Intro to Visual Studio Provides a set of APIs and types for common functionality Microsoft Visual Studio Pro...

Module 1 - Intro to Visual Studio Provides a set of APIs and types for common functionality Microsoft Visual Studio Programming languages supported by.Net An integrated development environment (IDE) Framework from Microsoft ○ C# It is used to develop computer programs, ○ F# websites, web apps, web services, and mobile ○ Visual Basic apps. Compiled code is stored in assemblies (files with a.dll or.exe file extension) Visual Studio Provides a solution explorer window that.Net Framework Class Library enables you to explore and manage your Exposes features of the runtime and provides a solutions and projects library of classes that are accessed by all webs, windows-based, and XML web service Solution Explorer applications Displays the projects that form your solution, the files, and folders in a project, and assemblies, C#.Net com objects or files the project references Widely used programming language used to make websites, games, mobile apps, desktop Windows Forms apps, etc. A UI framework for building Windows desktop apps; it provides one of the most productive C# ways to create desktop apps based on the visual A Microsoft object-oriented programming designer provided in Visual Studio language that runs on.NET Framework Toolbox Window Console.WriteLine Displays controls that you can add to visual Method used to display a message in C# studio projects Console: A type that represents the console window Properties Window WriteLine: A method of the console type that Used to view and change the design, time, prints a line of text to that text console properties, and events of selected objects Data types can be classified based on their memory.Net Platform location: Provides several core technologies and services Value types - stores data values in its own that simplify the development of web-based memory space (e.g. int i = 5;) applications Reference types - does not store its value Components of.Net Platform directly; it saves the address where the value is A. Developer tools kept; contains a reference to data that is B. Devices allocated on the heap (e.g. string name = C. User Experience (UX) “Leanne Dagsil”;) D. Servers Pointer types - stores the address of another E. XML Web Services pointer (e.g. int * p;).Net Framework Variables are storage containers for data values. The ff Provides the foundation for building and running are predefined data types in C#:.Net based applications object - the ultimate type of all the other types Consists of 2 components: sByte - 8-bit signed integral type A. Common Language Runtime (CLR) short - 16-bit signed integral type Manages the execution of.Net int - 32-bit signed integral type code long - 64-bit signed integral type Includes a feature called string - sequence of unicode characters Just-In-Time (JIT) compilation float - single-precision floating point type B..Net Framework Class Library double - double-precision floating point type decimal - precide decimal type with 28 Declaration Definition significant digits bool - boolean type (True or False) public Access is not limited char - a charactered value is a unicode character private Access is limited to the containing class internal Access is limited to this program Module 2 Pt. 1 - OOP protected Access is limited to the containing class and to types derived from the Object Oriented Programming (OOP) containing class. Built upon structured programming with several Protected-internal Access is limited to the containing new concepts class, derived classes, or to members of this program. Principles of OOP A. Encapsulation Binds together the code and the data it Method manipulates to keep them both safe A class member that is used to define the from outside interference and misuse actions that can be performed by that object or All important information is contained class inside an object and only selected information is exposed Syntax for method declaration B. Polymorphism [attributes] [modifiers] return-type In Greek, means “many forms” method-name ([parameter-list]) { The quality that allows one interface to statement-block } access a general class of actions “One interface, multiple methods” Note: C. Inheritance If the method is not designed to return a value, One object can acquire the properties of its return type is void another object The method name and parameter list is known Supports the concept of hierarchical as the method signature classification The this keyword is used to refer to the current instance of an object. Class A blueprint C# Timer Defines the characteristics or types of data an Used to implement a timer in C# object could contain as well as methods that The Timer class represents a Timer control that describe the behavior of the object executes a code block at a specified interval of time repeatedly Class Definition Syntax [attributes] [access-modifiers] class-identifier {class-body} Module 2 Pt. 2 - Array List Object An instance of a class ArrayList A non-generic collection of objects whose size Object Creation Syntax increases dynamically [class-identifier] [object-name] = new [class-identifier] How to create an ArrayList Using System.Collections; ArrayList arlist = new ArrayList(); Access Modifiers or would validate a piece of information as being true or false, on or off, yes or no, 1 or 0. var arlist = new Arraylist(); int - An integer; natural number; a number that can start with a + or - sign. Iterate through an ArrayList tinyint - Can hold positive numbers that range The ArrayList implements the ICollection from 0 to 255. Interface that supports iteration of the collection smallint - Can hold numbers that range from types. -32,768 to 32,767 The foreach and the for loop can be used to bigint - Can hold numbers that range from iterate an ArrayList. -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Methods of an ArrayList binary - Used for a column that would hold Count - returns the total number of elements in hexadecimal numbers (e.g., 0x7238, 0xFA36, or an ArrayList 0xAA48D). Use the binary data type if all entries Add() - used to add elements in an ArrayList under the column would have the exact same InsertRange() - used to insert a collection in an length (or quantity). Varbinary can be used for ArrayList at the specified index hexadecimal numbers that allow dissimilar Remove() - removes element in an ArrayList entries. RemoveAt() - removes an element at the numeric and decimal - A decimal number is a specified index number that can have a period between digits RemoveRange(0,2) - removes elements at the float and real - A floating-point number is a specified range, exclusive of the second index fractional number, like the decimal type. Contains() - determines whether the specified Floating-point numbers can be used to apply an element exists in the ArrayList; returns a approximation to the actual number that a field is boolean expression supposed to carry money - Used on a column whose data would Other methods not specified in the module: consist of currency values from Insert() - Inserts an element at a specified index -922,337,203,685,477,5808 to Sort() - Sorts the elements in an ArrayList 922,337,203,685,477,5807 Reverse() - Reverses the order of elements in smallmoney - Used to store currency values an ArrayList from -214,748,3648 to 214,748,3647 IndexOf() - searches for the specified object and char - A field of characters can consists any returns the zero-based index of the first kinds of alphabetical symbols in any occurrence combination, readable or not. Used on columns that hold a fixed number of characters. varchar - Used on columns that hold strings of different lengths. The maximum length of text that a field of varchar type can hold is equivalent Module 3 - Intro to ADO.NET to 8 kilobytes. text - Can be applied to a field whose data Database would consist of ASCII characters. As opposed A collection of information destined to make that to a varchar type of field, a text type of field can information easy to view and exploit hold text that is longer than 8 kilobytes. nchar, nvarchar, ntext - Follows the same rules Visual C# provides objects that work with the ff: as the char, varchar, and text, except that they Object Linking and Embedding Databases (OLE can be applied to columns that would hold DB) international characters. SQL Server datetime - Used for columns whose data would Oracle Databases consist of data and/or time values. The date Microsoft Data Engine (MSDE) value of a datetime field can be compromised Open Database Connectivity (ODBC) between January 1st, 1753 to December 31st, 9999. Types of Data bit - smallest data type of the SQL Server categories of columns. Used for a field that smalldatetime - The date value can be compromised between January 1st, 1900 and LIKE - used in conjunction with a WHERE June 6, 2079 clause to search for a specified pattern in a column Data Object Viewer SELECT col_name(s) Visual C# provides several objects that allow FROM table_name interaction with databases. These objects fall in WHERE col_name LIKE pattern one of 5 categories //The symbol % is a wildcard that can be used 1. Connections - allows a program to to substitute one or more characters in a string connect to a database 2. Data containers - hold data after it has been loaded from a database WHERE - works in conjunction with other SQL 3. Data adapters - moves the data commands like SELECT, INSERT, and UPDATE between databases and containers to specify a search condition for these 4. Command objects - allow manipulation statements of the data SELECT AverageTemperature 5. Navigation objects - allow a user to FROM Weather move through (and modify) data WHERE City = "Dasmarinas" DataGridView Property DISTINCT - works in conjunction with the Rows - Gets a collection that contains all the SELECT clause and selects only unique data rows in the DataGridView control from a database table(s) SELECT DISTINCT col_name BindingDataSource Class FROM table_name Position() - Gets or sets the index of the current item in the underlying list MoveFirst() - Moves the first item in the list UPDATE - updates data in database table MoveLast() - Moves the last item in the list UPDATE table_name MoveNext() - Moves to the next item in the list SET col_name1 = value1, col_name2 = MovePrevious() - Moves to the previous item in value2, … the list DELETE - deletes data from a database table SqlDataReader Class Methods GetInt16() - Gets the value of the specified DELETE FROM table_name column as a 16-bit signed integer GetInt32() TRUNCATE - deletes all rows from a database GetInt64() table GetOrdinal() - Gets the column ordinal, given TRUNCATE TABLE table_name the name of the column GetDecimal() - Gets the value of the specified column as a Decimal object ORDER BY - defines in what order to return a Read() - Advances the SqlDataReader to the data set retrieved with a SQL SELECT next record statement SELECT * FROM table_name SQL commands ORDER BY col_name SELECT - selects data from one or more database tables and/or views SQL Aggregate Functions SELECT col_name1, col_name2, … FROM Used to sum, count, get the average, get the table_name minimum/maximum values from a column or from a subset of column values INSERT INTO - inserts data into a SQL table You can specify search criteria with the SQL INSERT INTO table_name WHERE clause for any SQL aggregate functions VALUES value1, value2, … SQL Aggregate Functions JOIN table_name2 ON COUNT() - used to count the number of table_name1.col_name = rows/records in a table table_name2.col_name SELECT COUNT(*) FROM table_name UNION - merges the results of two or more MAX() - returns the maximum value from a SELECT SQL queries into one result set. All numeric column in a table expressions participating in the union must have the same structure. The SQL UNION expression SELECT MAX(col_name) FROM table_name will remove all duplicates (if any). SELECT col_name1, col_name2, col_name3 FROM table_name1 UNION MIN() - returns the minimum value from a SELECT col_name1, col_name2, numeric column in a table col_name3 FROM table_name2 SELECT MIN(col_name) FROM table_name GROUP BY - used along with SQL aggregate functions and specifies the groups where AVG() - returns the average value from a selected rows are placed. When one or more numeric column in a table aggregate functions are presented in the SQL SELECT AVG(col_name) SELECT column list, the SQL GROUP BY FROM table_name clause calculates a summary value for each group. SUM() - returns the sum from a numeric column SELECT col_name1, AVG(col_name2) in a table FROM table_name GROUP BY col_name1 SELECT SUM(col_name) FROM table_name When GROUP BY is used, one of the ff must be true: 1. Each column which is not part of an aggregate SQL Commands (Cont.) expression in the select list is presented in the HAVING - provides a search condition for a SQL GROUP BY clause group or aggregate and works together with the 2. The SQL GROUP BY expression matches SQL SELECT clause. The SQL WHERE clause exactly in the select list expression condition is tested against every row of data, while the SQL HAVING clause condition is ---------------------------------------------------------------- tested against the groups and/or aggregates specified in the SQL GROUP BY clause and/or PRACTICE PROGRAMS the SQL SELECT column list. If a SQL 1. Write a C# program that will accept 2 numbers statement contains both WHERE and HAVING, then display its sum, difference, products, and the WHERE clause is applied first, then HAVING quotient. is applied to the groups and/or aggregates. 2. Write a C# program that will compute the SELECT col_name1, AVG(col_name2) student’s average grade. The formula is (prelim FROM table_name + midterm + final)/3. Display the student’s GROUP BY col_name1 information, their average, as well as remark (60 HAVING AVG(col_name2) > value is the passing grade). JOIN - selects data from two or more tables tied together by matching table columns. SELECT table_name1.col_name1, table_name2.col_name2 FROM table_name1

Use Quizgecko on...
Browser
Browser