SlideShare une entreprise Scribd logo
1  sur  15
See Sharp
A C# programming tutorial


Prepared By: JM Ramos
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)
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”
What can you do with C#

   • Windows Applications
   • Web Applications (ASP.NET)
   • Web Services (WCF)
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.
Adding Records to your Table

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


   Specifying the columns and
   corresponding values on
   those columns.
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
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’);
Modifyng Records

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

  Updates the record that has
  the id of my_id;
Sample UPDATE Statement

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

  Updates all records that
  has a firstname of ‘jm’
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.
Retrieving Records

   SELECT (column1, column2)
   FROM table_name WHERE id =
   my_id;
   Returns a result set
   containing columns
   specified in the query
   satisfying the condition
   Where clause is optional
Enough with the Crap. Coding na!

   • :DDDDD
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.
References

  • Beginning Visual C# 2010 (Watson
    2010)
  • http://en.wikipedia.org/wiki/SQL

Contenu connexe

Tendances

Tendances (20)

C# in depth
C# in depthC# in depth
C# in depth
 
C sharp
C sharpC sharp
C sharp
 
Introduction to C# Programming
Introduction to C# ProgrammingIntroduction to C# Programming
Introduction to C# Programming
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
C#.NET
C#.NETC#.NET
C#.NET
 
C# Delegates
C# DelegatesC# Delegates
C# Delegates
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
C# programming language
C# programming languageC# programming language
C# programming language
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .net
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Generics C#
Generics C#Generics C#
Generics C#
 
Loops c++
Loops c++Loops c++
Loops c++
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
dot net technology
dot net technologydot net technology
dot net technology
 

Similaire à C# Tutorial

MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
webhostingguy
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
SANTOSH RATH
 

Similaire à C# Tutorial (20)

C# Basic Tutorial
C# Basic TutorialC# Basic Tutorial
C# Basic Tutorial
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
MySQL Database System Hiep Dinh
MySQL Database System Hiep DinhMySQL Database System Hiep Dinh
MySQL Database System Hiep Dinh
 
mysqlHiep.ppt
mysqlHiep.pptmysqlHiep.ppt
mysqlHiep.ppt
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
Oracle notes
Oracle notesOracle notes
Oracle notes
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms sql-final
 
SQL Server Select Topics
SQL Server Select TopicsSQL Server Select Topics
SQL Server Select Topics
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
Module 3
Module 3Module 3
Module 3
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Lab
LabLab
Lab
 

C# Tutorial

  • 1. See Sharp A C# programming tutorial Prepared By: JM Ramos
  • 2. 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)
  • 3. 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”
  • 4. What can you do with C# • Windows Applications • Web Applications (ASP.NET) • Web Services (WCF)
  • 5. 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.
  • 6. Adding Records to your Table INSERT INTO table_name(column1,column2) VALUES(value1,value2); Specifying the columns and corresponding values on those columns.
  • 7. 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
  • 8. 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’);
  • 9. Modifyng Records UPDATE table_name SET column1 = value1, column2 = value2 WHERE id = my_id; Updates the record that has the id of my_id;
  • 10. Sample UPDATE Statement UPDATE Phonebook SET PhoneNumber = ‘09099234556’ WHERE FirstName = ‘jm’; Updates all records that has a firstname of ‘jm’
  • 11. 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.
  • 12. Retrieving Records SELECT (column1, column2) FROM table_name WHERE id = my_id; Returns a result set containing columns specified in the query satisfying the condition Where clause is optional
  • 13. Enough with the Crap. Coding na! • :DDDDD
  • 14. 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.
  • 15. References • Beginning Visual C# 2010 (Watson 2010) • http://en.wikipedia.org/wiki/SQL