+ All Categories
Home > Technology > C# Basic Tutorial

C# Basic Tutorial

Date post: 16-Apr-2017
Category:
Upload: luis-goldster
View: 151 times
Download: 0 times
Share this document with a friend
15
See Sharp A C# programming tutorial Prepared By: Luis Goldster
Transcript
Page 1: C# Basic Tutorial

See SharpA C# programming tutorial

Prepared By: Luis Goldster

Page 2: C# Basic Tutorial

Hello World – A quick glance of this tutorial

• Introduction to C#.net• Introduction to SQL• The OLEDB Library• Setting up your connection string• Creating the connection Class• Create Read Update Delete

(CRUD)

Page 3: C# Basic Tutorial

What’s with C#

• The Language of choice in the .NET Framework

• Comes with a clear syntax, derived from C/C++

• Ease with learning the language

• C# is a “Type Safe Language”

Page 4: C# Basic Tutorial

What can you do with C#

• Windows Applications• Web Applications (ASP.NET)• Web Services (WCF)

Page 5: C# Basic Tutorial

Structured Query Language (SQL)

• A language use for manipulating and retrieving records in a RDBMS

• Based on Relational Algebra tuple relational calculus, its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

Page 6: C# Basic Tutorial

Adding Records to your Table

INSERT INTO table_name(column1,column2) VALUES(value1,value2);

Specifying the columns and corresponding values on those columns.

Page 7: C# Basic Tutorial

Adding Records Cont..

INSERT INTO table_name VALUES(value1,value2,..valueN);

Use for adding records provided that the number of values match the number of columns

Page 8: C# Basic Tutorial

Sample INSERT INTO Statement

Let’s assume we have table phonebook with 3 columns, FirstName, LastName, and PhoneNumber

INSERT INTO phonebook VALUES(‘jm’,’ramos’,’123’);

Page 9: C# Basic Tutorial

Modifyng Records

UPDATE table_name SET column1 = value1, column2 = value2 WHERE id = my_id;

Updates the record that has the id of my_id;

Page 10: C# Basic Tutorial

Sample UPDATE Statement

UPDATE Phonebook SET PhoneNumber = ‘09099234556’ WHERE FirstName = ‘jm’;

Updates all records that has a firstname of ‘jm’

Page 11: C# Basic Tutorial

Deleting Records

DELETE FROM table_name WHERE id = my_id;

Deletes the record the has the id = my_id. If the user fails to put a where condition, all records from the table will be lost.

Page 12: C# Basic Tutorial

Retrieving Records

SELECT (column1, column2) FROM table_name WHERE id = my_id;Returns a result set containing columns specified in the query satisfying the conditionWhere clause is optional

Page 13: C# Basic Tutorial

Enough with the Crap. Coding na!

• :DDDDD

Page 14: C# Basic Tutorial

Things to Remember:

• String data types in SQL should be enclosed with single quotes.

• Values are separated by commas• End every statement with

Semicolon• Just get what you need.• Use pascal casing.

Page 15: C# Basic Tutorial

References

• Beginning Visual C# 2010 (Watson 2010)

• http://en.wikipedia.org/wiki/SQL


Recommended