Vous êtes sur la page 1sur 192

Frat niversitesi - Mustafa ULA - (2010)

ASP MS ACCESS
Okt. Mustafa ULA
mulas@firat.edu.tr

INTERNET TABANLI
PROGRAMLAMA
Frat niversitesi Enformatik Blm - 2010

Frat niversitesi - Mustafa ULA - (2010)

ASP VE VERITABANI
ILE UYGULAMALAR

Frat niversitesi - Mustafa ULA - (2010)

ASPYE GIRI

ASP Nedir ?

ASP Microsoft'un gelitirdii bir web programlama


teknolojisidir.
ASP 1996 ylnda gelitirilmitir.
Active Server Pages ( Aktif sunucu sayfalar ) nn
ksaltlm biimidir.
ASP Web sunucusu ile alan bir script dilidir.
ASP sayesinde veri taban ilemleri ve elektronik ticaret
siteleri gibi interaktif uygulamalar kolayca yaratlabilir.

Frat niversitesi - Mustafa ULA - (2010)

ASP Nedir ?

Bir HTML sayfay snamak iin sadece Browser


programna ihtiyacnz var.
Bir HTML belgesini ift tkladnzda varsaylan Browser
alacak ve bu sayfay yorumlayarak, grntleyecektir.
Fakat uzants .asp olan bir dosyay ift tkladnzda
ya Windows size bu dosyay hangi programla amak
istediinizi soracaktr yada varsaylan editrde ierik
olarak grntleyecektir.

Frat niversitesi - Mustafa ULA - (2010)

ASP dosyalarn yaynlamak

Asp dosyalarnn yaynlanabilmesi iin web sunucuya


ihtiyac vardr.
Web sunucunun kurulabilmesi iin ;
Bilgisayarnzda ya bir ethernet kart yada modeminizin
bulunmas

Frat niversitesi - Mustafa ULA - (2010)

Web Sunucu

Windows 2003/2008/XP/Vista/7 kullanyorsanz


IIS ( Internet Information Services - Internet Hizmetleri
Yneticisi )
kullanmanz gerekir.

Frat niversitesi - Mustafa ULA - (2010)

Web Sunucu

IIS ise Windows'a sonradan ekleniyor.


Windows 2003/2008 Enterprise ve XP/Vista/7 de
kurulmam olarak gelir.
Denetim Masas*Program Ekle/Kaldr*Windows
Bileenleri Ekle/Kaldr dan ekliyorsunuz.

Frat niversitesi - Mustafa ULA - (2010)

ASP Kodlar

Bir html sayfasna Javascript yazldnda sa tklayarak


kayna grntle dediimizde bu javascript kodlarn
grebiliriz.
Fakat Asp'de yazdmz kodlar kesinlikle bu ekilde
grnmeyecek bylelikle bir ok aba harcayarak
yazdnz kodlar kimse alamayacaktr.

Frat niversitesi - Mustafa ULA - (2010)

ASP Kodlar

Html sayfalar ierisine asp kodlarn gmerek dinamik


sayfalar oluturabiliriz.
Bu html kodlarnn ierisine gmdmz asp kodlar
sunucu tarafnda ilenerek istemcinin browserna sadece
duraan html kodlar gnderilir.
ASP kodlarn yazmaya balamadan nce

Frat niversitesi - Mustafa ULA - (2010)

Gerekli bilgiler

Asp bir sunucu tarafl script dilidir.


<% %> iaretleri arasna yazlr ,
Sayfa balangcnda kullanlacak olan script dili
belirtilmelidir.
<%@ Language=VBScript %>

Frat niversitesi - Mustafa ULA - (2010)

HTML Dosyalarnn letilmesi

Frat niversitesi - Mustafa ULA - (2010)

ASP Dosyalarnn etilmesi

Frat niversitesi - Mustafa ULA - (2010)

ASP Dosyalarnn etilmesi

ASP dosyas hem HTML kodlar ierir, hem de iinde bir


Script diliyle yazlm kodlar vardr.
Web Sunucundan asp sayfas istendiinde web sunucu
bunu ASP.DLL e gnderir,
ASP.DLL, nce gelen .asp dosyasnda hangi Script
dilinin kullanldna bakar ve bunun iin gerekli ortam
oluturur,

Frat niversitesi - Mustafa ULA - (2010)

ASP Dosyalarnn etilmesi

ASP.DLL, kendisine sevk edilen dosyay satr satr okur


ve nce dosyadaki ASP kodlarnn gerektirdii HTML
deerlerini bulur; yani nce ASP icra edilir, gerei yerine
getirilir.
Sonra HTML blmleri ile birletirilip sonuta sunucuya
saf ve temiz bir HTML sayfas gnderilir.
Bu sayfann iinde bir satr bile ASP kodu bulunmaz.

Frat niversitesi - Mustafa ULA - (2010)

ASP Dosyalarnn etilmesi

Eer sayfanza ziyaretinin Browsernda almas


amacyla Javascript veya VBScript kodlar koydu iseniz,
elbette bu kodlar HTML'in paras olarak ziyaretiye
gidecektir.
Fakat giden sayfada artk ASP'ye ilikin hi bir ey
kalmam olacaktr.

Frat niversitesi - Mustafa ULA - (2010)

ASPnin Avantajlar

Sonsuz Dinamiklik
Gvenlik
Modlerlik
Hz
Sistem Yneticisine Kolaylk
Veri Madencilii
nteraktiflik

Frat niversitesi - Mustafa ULA - (2010)

Frat niversitesi - Mustafa ULA - (2010)

FORMLAR

FORM

Form , sizin Web tasarmcs olarak sayfanza koyacanz


ve iinde ziyaretinin dolduraca boluklar veya ziyaretinin
yapaca tercihleri belirtecei kutular bulunan ve en
sonunda bu bilgileri size gnderecei bir dme bulunan bir
web sayfasdr.
Formlarda tm HTML etiketleri gibi bir etiketle balar ve biter

<form> </form>

Frat niversitesi - Mustafa ULA - (2010)

rnek Form

Frat niversitesi - Mustafa ULA - (2010)

FORM

<form><form> etiketinin arasna ya kullancnn


dolduraca boluklar , yada tercih yapmasna imkan veren
listeler ve dmelerle doldurmamz gerek.
Bunu salayan balca kontrol elemanlarmz :
<input>
<select>
<textarea>
etiketleridir.
Frat niversitesi - Mustafa ULA - (2010)

<input> etiketi

<input> etiketi ile ziyaretiye forma , klavyesinden veya


mouse ile iaretlemek suretiyle bilgi girmesi imkan
veririz.
Bu etiketi kullanmann en genel biimi yledir :

<input type= name= value= size= maxlength=>

Frat niversitesi - Mustafa ULA - (2010)

<input type=text>

Kullancnn klavyesi ile bir metin girmesini salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=password>

Kullancnn parola girmesini salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=checkbox>

aretlenebilir kutular oluturmay salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=radio>

Radyo dmeleri oluturmay salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=button>

Tklanabilir form dmeleri oluturmaya yarar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=file>

Servera dosya gndermeyi salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=hidden>

Gizli metin alanlar oluturmay salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=submit> ve <input type=reset>

Submit :
Formdaki bilgileri servera gndermeyi salar .
Reset :
Formdaki bilgileri silmeyi (temizlemeyi) salar .

Frat niversitesi - Mustafa ULA - (2010)

<input type=submit> ve <input type=reset>

Frat niversitesi - Mustafa ULA - (2010)

Metin Alan : <textarea> Etiketi

Frat niversitesi - Mustafa ULA - (2010)

Seme Kutusu : <select> Etiketi

Frat niversitesi - Mustafa ULA - (2010)

Frat niversitesi - Mustafa ULA - (2010)

FORM
ELEMANLAR

TextBox

Frat niversitesi - Mustafa ULA - (2010)

TextBox

Frat niversitesi - Mustafa ULA - (2010)

TextArea

Frat niversitesi - Mustafa ULA - (2010)

TextArea

Frat niversitesi - Mustafa ULA - (2010)

RadioButton

Frat niversitesi - Mustafa ULA - (2010)

RadioButton

Frat niversitesi - Mustafa ULA - (2010)

CheckBox

Frat niversitesi - Mustafa ULA - (2010)

CheckBox

Frat niversitesi - Mustafa ULA - (2010)

ListBox

Frat niversitesi - Mustafa ULA - (2010)

ListBox

Frat niversitesi - Mustafa ULA - (2010)

ListBox

Frat niversitesi - Mustafa ULA - (2010)

Hidden

Frat niversitesi - Mustafa ULA - (2010)

Frat niversitesi - Mustafa ULA (2010)

VBSCRIPT

47

Deikenler
48

SiraNO=1

Frat niversitesi - Mustafa ULA (2010)

Deiken Tanmlama
49

Frat niversitesi - Mustafa ULA (2010)

Deiken Tanmlama
50

Frat niversitesi - Mustafa ULA (2010)

Sabit Deerler
51

Const DolarDeger = 560780

Const SirketinAdi = Web Tasarm ve Site Onarm A..

Const Slogan = Siteler Onarlr

Frat niversitesi - Mustafa ULA (2010)

Array
52

<%
Dim Gunler = Array (Pazartesi , Sal , aramba ,
Perembe , Cuma , Cumartesi, Pazar)
%>
<%=Gunler(6)%>

Frat niversitesi - Mustafa ULA (2010)

Deiken Array Tanmlama


53

Frat niversitesi - Mustafa ULA (2010)

rnek
54

Frat niversitesi - Mustafa ULA (2010)

rnek
55

Frat niversitesi - Mustafa ULA (2010)

Frat niversitesi - Mustafa ULA (2010)

56

ARITMETIKSEL VE
MANTIKSAL ILEMLER

Aritmetik ve Mantksal Operatrler


57
lev

Snf

Operatr

Toplama

kartma

arpma

Blme

ssn alma

Tamsay blme

Mod

Modler aritmetik

Bir deikenin dierine eit olduunu snar

<>

Bir deikenin dierine eit olmadn snar

>and<

Bir deikenin dierinden byk veya kk olduunu snar (and kelimesi var)

>= and <= Bir deikenin dierinden byk veya eit, veya kk veya eit olduunu snar (and kelimesi var)

Aritmetik

Karlatrma

Is

Bir ifadedeki iki referansn ayn Nesneye yaplp yaplmadn snar

And

Bir veya daha fazla deikeni test olarak karlatrr

Or

Bir ilemin devam iin hangi koulun olumas gerektiini snar

Not

Bir ifadeyi negatif hale getirir

XoR

Sadece bir koulun doru olup olmadn snar

Eqv

ki deikenin eitliini snar

Imp

ki ifadede mantksal implikasyon ilemi yapar.

Frat niversitesi - Mustafa ULA (2010)

Mantksal

Mantksal Snamalar
58

If.. Else

If art Then

[art doru ise yaplacak iler]

Else
[art doru deilse yaplacak iler]
End If

Frat niversitesi - Mustafa ULA (2010)

If..Else - rnek
59

<%

If Hour(Now) <12 Then


Response.Write "Gnaydn! "

ElseIf Hour(Now) >= 18 Then


Response.Write "yi akamlar! "

Else
Response.Write "Tnaydn! "

End If

Response.Write "<BR>"

Response.Write "Site Onarm Sitesine Hogeldiniz"

%>

Frat niversitesi - Mustafa ULA (2010)

Select Case
60

<%
Select Case Hour(Now)
Case 0,1,2,3,4,5,6,7,8,9,10,11
Response.Write "Gnaydn!"
Case 12,13,14,15,16,17
Response.Write "Tnaydn"
Case Else
Response.Write "yi Akamlar!"
End Select
Response.Write "<BR>"
Response.Write Onarm Sitesine Hogeldiniz"
%>
Frat niversitesi - Mustafa ULA (2010)

Do..Loop
61

Do While koul

koul doru iken yaplacak iler

Loop
------------------Do While i>10
KOD
Loop
Do
KOD
Loop While i>10
Do Until i=10
KOD
Loop
Do
KOD
Loop Until i=10
Do Until i=10
i=i-1
If i<10 Then Exit Do
Loop

Frat niversitesi - Mustafa ULA (2010)

While...Wend
62

While sayac <= 5


Response.Write Gunler(sayac)
Response.Write "<BR>"sayac = sayac + 1

wend

Frat niversitesi - Mustafa ULA (2010)

For..Next dngs
63

<%
Dim Gunler
Gunler = Array("Pazartesi", "Sal", "aramba", "Perembe",
"Cuma", "Cumartesi", "Pazar")
For sayac = 0 to 6
Response.Write Gunler(sayac)
Response.Write "<BR>"
Next
%>
<%
for i=1 to 10 step 2
response.write(i)
next
%>
Frat niversitesi - Mustafa ULA (2010)

64

<%
Dim cars(2)
cars(0)="Volvo"
cars(1)="Saab"
cars(2)="BMW"
For Each x In cars
response.write(x & "<br />")
Next
%>

Frat niversitesi - Mustafa ULA (2010)

Dng durdurulmak istendiinde


65

For i=1 to 10
If Degisken1 > Degisken2 Then
Exit For

End if
next

Frat niversitesi - Mustafa ULA (2010)

Frat niversitesi - Mustafa ULA (2010)

66

SIK KULLANILAN
HAZIR FONKSIYONLAR

Tarih Fonksiyonlar
67

Date: Bugn tarihini verir. (25.03.2000 gibi)

Time: O andaki saati verir. (22:24:40 gibi)

Now: O andaki tarih ve saati birlikte verir. (25.03.2000 22:24:40 gibi)

VBScriptin buna ek olarak Weekday (haftann gn), WeekdayName (gnn ad) ve


Monthname (ayn ad) fonksiyonlar da vardr. Bu fonksiyonlar deerlerini Date
fonksiyonuna gre alrlar. rnein,

<%= WeekdayName(Weekday(Date))%>

komutu bize bugn Cumartesi ise Cumartesi deerini verir.

<%= MonthName(Month(Date))%>

komutu bize bu ay Mart ise Mart deerini verir. VBScriptin bunlara ek olarak Day
(gn), Month (ay) ve Year (yl) fonksiyonlar da deerlerini Date fonksiyonundan
alarak, size bir rakam verirler. Eer tarih 25 Mart 2000 ise:

<%= Day(Date)%>... 25

<%= Month(Date)%>... 3

<%= Year(Date)%>... 2000


Frat niversitesi - Mustafa ULA (2010)

Karakter-dizisi Fonksiyonlar
68

Karakter-dizisi veya String, VBScript iin herey olabilir. Sana Sevdann Yollar Bana
Kurunlar bir Stringdir. Bugn 7 Austos 2000 bir Stringdir. Doum Gnn Kutlu
Olsun! bir Stringdir. Web sitemizi ziyaret eden kiinin formlarmza yazaca ve
Gnder tuunu tklayarak Servera gnderecei bilgiler Stringdir. Fakat bunlarn
hepsi olduu ekliyle iimize yaramaz. Bunlar yeniden dzenlemek, iinden
semeler yapmak veya biimlerini deitirmek gerekebilir. VBScript bu amala
kullanlmaya hazr bir dizi fonksiyon verir:
InStr Uzun bir Stringin iinde vereceiniz daha ksa bir Stringin bulunup
bulunmadn arar; bulursa bu ksa Stringin balama noktasnn deerini verir.
Diyelim ki, Sana Sevdann Yollar Bana Kurunlar Stringini Kayahan deikenine,
Sevda kelimesini de Ara deikenine atadnz. InStr fonksiyonu ile Arann deerinin
yerini Kayahann deerinin iinde bulabilirsiniz:
Yer = InStr(Kayahan, Ara)
Yerin deeri 6 olacaktr; nk Sevda kelimesi, uzun Stringde 6nc
karakterden balamaktatr.

Frat niversitesi - Mustafa ULA (2010)

Karakter-dizisi Fonksiyonlar
69

Len Bir Stringin uzunluunu belirler. Yukardaki rnekte yer alan Kayahan
deikenin uzunluunu yle belirleyebiliriz:

Uzunluk = Len(Kayahan)

Uzunluk deikeninin deeri 36 olacaktr.

UCase

Vereceiniz bir Stringin tm karakterlerini byk harfe evirir.

YeniString = UCase(Kayahan)
Yeni Stringin deeri: SANA SEVDANIN YOLLARI BANA KURUNLAR
olacaktr.
LCaseVereceiniz bir Stringin tm karakterlerini kk harfe evirir.

YeniString = LCase(Kayahan)

Yeni Stringin deeri: sana sevdann yollar bana kurunlar olacaktr.

LTrim, RTrim, Trim


Verdiiniz Stringin (srasyla) solunda yani ba tarafnda;
sanda yani sonunda ve hem banda ve hem de sonundaki boluklar temizler.

Frat niversitesi - Mustafa ULA (2010)

Karakter-dizisi Fonksiyonlar
70

Spaceinde, vereceiniz say kadar boluk olan bo bir String oluturur. rnein

Bosluk = Space(20)

Bosluk deikenin deeri

(20 boluk) olacaktr.

String stediiniz sayda ve istediiniz bir karakterle bir String oluturur.

YeniString = String(3, *)

YeniString deikeninin deeri *** olacaktr.

Left, Right
Bir Stringin iinde soldan (batan) veya sadan (sondan) verdiiniz
sayya kadar olan karakterleri verir. rnein, yine yukardaki Kayahan deikenini
kullanrsak:
Solda = Left(Kayahan, 4)
Solda deikeninin deeri Sana olacaktr; nk Kayahan deikeninin
soldan itibaren drt harfi Sana kelimesine denk geliyor.

Frat niversitesi - Mustafa ULA (2010)

Karakter-dizisi Fonksiyonlar
71

Mid Bir Stringin iinde balang noktasn ve karakter olarak boyunu verdiiniz
alanda yer alan Stringi verir.
Ortada = Mid(Kayahan, 5, 8)
Ortada deikeninin deeri Sevdan olacaktr; nk Kayahan deikeninin
soldan 5nci deikeninden itibaren 8 karakterlik alanda Sevdan karakterleri yer
alyor.

Frat niversitesi - Mustafa ULA (2010)

72

Dizi-Deiken (Array)
Fonksiyonu

Dim Ogrenciler()
Bu komutla, Ogrenciler dizi-deikeni oluturulur; ancak
eleman says belirtilmedii iin dizi dinamiktir; yani daha
sonra bu dizinin eleman sayn belirleyebilirsiniz. Bunu:
ReDim Ogrenciler(15)
Mevcut dizinin elemanlarn ve onlarn deerlerini
korumak istiyorsak:
ReDim Preserve Ogrenciler(20)

Frat niversitesi - Mustafa ULA (2010)

Test Fonksiyonlar
73

Bu zel fonksiyonlardan dnen deer True (doru) veya False (yanl) olur;
doru sonucun deeri 1, yanl sonucun deeri ise 0dr:
IsArray
Bir deikenin dizi-deiken (Array) olup olmadn snar.
IsDate
Bir deikenin deerinin tarihe (Date) evrilip
evrilemeyeceini snar.
IsEmpty
Bir deikenin tanmlanp deer atanm olup olmadn
snar.
IsNull Bir deikenin geerli bir deer tutup tutmadn snar.
IsNumeric
Bir deikenin say olarak ileme tabi tutup tutulamayacan
snar
IsObject
Bir ifadenin geerli bir ActiveX veya OLE nesnesine
referansta bulunup bulunmadn snar.
TypeName
Bir deikenin trn belirtir.
VarType
Bir deikenin trn belirten sayy verir.
Frat niversitesi - Mustafa ULA (2010)

Frat niversitesi - Mustafa ULA (2010)

TM HAZIR
FONKSIYONLAR

74

VBScript - Date/Time functions


75
Function

Description

CDate
Date
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Day

Datay tarih bilgisine evirir


Bugnn tarihini geri dnderir
ki tarihi toplar.
Tarihlerin farkn alr
Herhangi bir tarihin istediiniz ksmn geri dnderir.
Ayr verilen Yl, gn, ay tarih formatna evirir
Herhangi bir stringi tarihe evirir.
Returns a number that represents the day of the
month (between 1 and 31, inclusive)
Returns an expression formatted as a date or time
Returns a number that represents the hour of the
day (between 0 and 23, inclusive)
Returns a Boolean value that indicates if the
evaluated expression can be converted to a date
Returns a number that represents the minute of the
hour (between 0 and 59, inclusive)

FormatDateTime
Hour
IsDate
Minute

Frat niversitesi - Mustafa ULA (2010)

VBScript - Date/Time functions


76

Month
MonthName
Now
Second
Time
Timer
TimeSerial
TimeValue
Weekday
WeekdayName
Year

Returns a number that represents the month of the


year (between 1 and 12, inclusive)
Returns the name of a specified month
Returns the current system date and time
Returns a number that represents the second of the
minute (between 0 and 59, inclusive)
Returns the current system time
Returns the number of seconds since 12:00 AM
Returns the time for a specific hour, minute, and
second
Returns a time
Returns a number that represents the day of the
week (between 1 and 7, inclusive)
Returns the weekday name of a specified day of the
week
Returns a number that represents the year

Frat niversitesi - Mustafa ULA (2010)

VBScript - Math Functions


77
Function

Description

Abs
Atn
Cos
Exp
Hex
Int
Fix
Log
Oct
Rnd

Returns
Returns
Returns
Returns
Returns
Returns
Returns
Returns
Returns
Returns
0
Returns
number
Returns
Returns
Returns

Sgn
Sin
Sqr
Tan

the absolute value of a specified number


the arctangent of a specified number
the cosine of a specified number (angle)
e raised to a power
the hexadecimal value of a specified number
the integer part of a specified number
the integer part of a specified number
the natural logarithm of a specified number
the octal value of a specified number
a random number less than 1 but greater or equal to
an integer that indicates the sign of a specified
the sine of a specified number (angle)
the square root of a specified number
the tangent of a specified number (angle)

Frat niversitesi - Mustafa ULA (2010)

VBScript - String Functions


78

Function
InStr
InStrRev
LCase
Left
Len
LTrim
RTrim
Trim
Mid
Replace
Right
Space
StrComp

Description
Returns the position of the first occurrence of one string within another. The
search begins at the first character of the string
Returns the position of the first occurrence of one string within another. The
search begins at the last character of the string
Converts a specified string to lowercase
Returns a specified number of characters from the left side of a string
Returns the number of characters in a string
Removes spaces on the left side of a string
Removes spaces on the right side of a string
Removes spaces on both the left and the right side of a string
Returns a specified number of characters from a string
Replaces a specified part of a string with another string a specified number
of times
Returns a specified number of characters from the right side of a string

String

Returns a string that consists of a specified number of spaces


Compares two strings and returns a value that represents the result of the
comparison
Returns a string that contains a repeating character of a specified length

StrReverse
UCase

niversitesi - Mustafa ULA (2010)


Reverses aFrat
string
Converts a specified string to uppercase

VBScript - Conversion Functions


79

Function
Asc
CBool
CByte
CCur
CDate
CDbl
Chr
CInt
CLng
CSng
CStr
Hex
Oct

Description
Converts the first letter in a string to ANSI code
Converts an expression to a variant of subtype Boolean
Converts an expression to a variant of subtype Byte
Converts an expression to a variant of subtype Currency
Converts a valid date and time expression to the variant of
subtype Date
Converts an expression to a variant of subtype Double
Converts the specified ANSI code to a character
Converts an expression to a variant of subtype Integer
Converts an expression to a variant of subtype Long
Converts an expression to a variant of subtype Single
Converts an expression to a variant of subtype String
Returns the hexadecimal value of a specified number
Returns the octal value of a specified number
Frat niversitesi - Mustafa ULA (2010)

VBScript - Array Functions


80

Function

Description

Array
Filter

Returns a variant containing an array


Returns a zero-based array that contains a subset of a
string array based on a filter criteria
Returns a Boolean value that indicates whether a
specified variable is an array
Returns a string that consists of a number of substrings
in an array
Returns the smallest subscript for the indicated
dimension of an array
Returns a zero-based, one-dimensional array that
contains a specified number of substrings
Returns the largest subscript for the indicated dimension
of an array

IsArray
Join
LBound
Split
UBound

Frat niversitesi - Mustafa ULA (2010)

VBScript - Format Functions


81

Function
FormatCurrency
FormatDateTime
FormatNumber
FormatPercent

Description
Returns an expression
value
Returns an expression
time
Returns an expression
Returns an expression
percentage

formatted as a currency
formatted as a date or
formatted as a number
formatted as a

Frat niversitesi - Mustafa ULA (2010)

VBScript Dier Fonksiyonlar


82

Function
Description
CreateObject Creates an object of a specified type
Returns a Boolean value that indicates whether
IsEmpty
variable has been initialized or not
Returns a Boolean value that indicates whether
IsNull
expression contains no valid data (Null)
Returns a Boolean value that indicates whether
IsNumeric
expression can be evaluated as a number
Returns a Boolean value that indicates whether
IsObject
expression is an automation object
Rounds a number
Round

Frat niversitesi - Mustafa ULA (2010)

a specified
a specified
a specified
the specified

Frat niversitesi - Mustafa ULA - (2010)

ASP VE ASP
BILEENLERI

Frat niversitesi - Mustafa ULA

ASP COOKIES

84

ASP Cookies
85

<%
Response.Cookies("firstname")="Alex"
Response.Cookies("firstname").Expires=#May 10,2012#
%>

<%
fname=Request.Cookies("firstname")
response.write("Firstname=" & fname)
%>

<%
Response.Cookies("user")("firstname")="John"
Response.Cookies("user")("lastname")="Smith"
Response.Cookies("user")("country")="Norway"
Response.Cookies("user")("age")="25"
%>

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

SESSION

86

ASP Session Object


87

Her kullancnn sunucuya balandnda


oluturulan deiken kmesidir. Session a
atlan bu deerler, tanmlanm timeout
deerine yada kullancnn oturumun
sonlandrlmasna bal olarak sunucu
hafzasnda tutulur. Kullancnn ard tm
asp dosyalarnda kullanlabilen deikenler
tanmlanmasn salar.

Frat niversitesi - Mustafa ULA

ASP Session Object


88

<%
Session.Timeout=5
%>
Oturum

sresini tanmlar

<%
Session.Abandon
%>
Annda

oturum kapatr

Frat niversitesi - Mustafa ULA

ASP Session Object


89

Deer Tanmlamak

Tanml Deeri Gsermek

<%
Session("username")="Donald Duck"
Session("age")=50
%>

Welcome <%=(Session("username"))%>

Tanml Deeri Tek Tek Silmek

<%
Session.Contents.Remove("sale")
%>
Frat niversitesi - Mustafa ULA

90

Tanml Deeri Tek Tek Silmek

<%
Session.Contents.RemoveAll("sale")
%>

Frat niversitesi - Mustafa ULA

Session Bilgileri
91

Oturuma Tanmlanm Tm Session Deerlerini


gstermek

Kod

<%
Session("username")="Donald Duck"
Session("age")=50
dim i
For Each i in Session.Contents
Response.Write(i & "<br />")
Next
%>

Ekran Grnts

username
age
Frat niversitesi - Mustafa ULA

92

If you do not know the number of items in the


Contents collection, you can use the Count property:

<%

Session("username")="Donald Duck"
Session("age")=50
dim i
dim j
j=Session.Contents.Count
Response.Write("Session variables: " & j)
For i=1 to j
Response.Write(i & = & Session.Contents(i) & "<br />")
Next
%>

Result:

Session variables: 2
username = Donald Duck
age = 50
Frat niversitesi - Mustafa ULA

Session.LCID
93

Frat niversitesi - Mustafa ULA

94

Frat niversitesi - Mustafa ULA

95

Session.SessionID
Session.Timeout=30 (Dakika cinsinden)

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

APPLICATION

96

ASP Application Object


97

Session nesnesi gibidir.


Fark
Application nesnesi tm kullanclar iin
tanmlanr.
Tek deiken tm kullanclar tarafndan
eriilebilir ve deitirilebilir.

Frat niversitesi - Mustafa ULA

98

<script language="vbscript" runat="server">


Sub Application_OnStart
application("vartime")=""
application("users")=1
End Sub
</script>

There are
<%
Response.Write(Application("users"))
%>
active connections.

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

#INCLUDE
FILE - VIRTUAL

99

ASP Including Files


100

#include Komutu

<html>
<body>
<h3>Words of Wisdom:</h3>
<p><!--#include file="wisdom.inc"--></p>
<h3>The time is:</h3>
<p><!--#include file="time.inc"--></p>
</body>
</html>

<!-- #include file ="headers\header.inc" -->


<!-- #include virtual ="/html/header.inc" -->

Frat niversitesi - Mustafa ULA

101

<%
fname="header.inc"
%>
<!--#include file="<%fname%>"-->

ALIMAZ

Frat niversitesi - Mustafa ULA

102

YANLI
<%
For i = 1 To n
<!--#include file="count.inc"-->
Next
%>
DORU
<% For i = 1 to n %>
<!--#include file="count.inc" -->
<% Next %>

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

GLOBAL.ASA

103

Global.asa
104

<script language="vbscript" runat="server">


Sub Application_OnStart
Application("visitors")=0
End Sub
Sub Session_OnStart
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub
</script>
Frat niversitesi - Mustafa ULA

105

<html>
<head>
</head>
<body>
<p>There are <%response.write(Application("visitors"))%>
online now!</p>
</body>
</html>

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

106

RESPONSE / REQUEST

Response
107

Write
Burffer
Flush
Clear
End
Expires
ExpiresAbsolute
IsClientConnected
ContentType
Charset
Frat niversitesi - Mustafa ULA

Response Properties
108
Property

Description

Buffer

Specifies whether to buffer the page output or not

CacheControl

Sets whether a proxy server can cache the output


generated by ASP or not
Appends the name of a character-set to the
content-type header in the Response object
Sets the HTTP content type for the Response object

Charset
ContentType

Sets how long (in minutes) a page will be cached on


a browser before it expires
ExpiresAbsolute Sets a date and time when a page cached on a
browser will expire
IsClientConnecte Indicates if the client has disconnected from the
server
d
Pics
Appends a value to the PICS label response header
Expires

Status

Specifies the value of the status line returned by the


serverFrat niversitesi - Mustafa ULA

Response Methods
109

Method
AddHeader
AppendToLog
BinaryWrite

Description
Adds a new HTTP header and a value to the HTTP
response
Adds a string to the end of the server log entry

Flush

Writes data directly to the output without any


character conversion
Clears any buffered HTML output
Stops processing a script, and returns the current
result
Sends buffered HTML output immediately

Redirect
Write

Redirects the user to a different URL


Writes a specified string to the output

Clear
End

Frat niversitesi - Mustafa ULA

Response.write
110

Frat niversitesi - Mustafa ULA

Response.redirect
111

Frat niversitesi - Mustafa ULA

Response.redirect
112

Frat niversitesi - Mustafa ULA

Response.buffer - flush
113

Frat niversitesi - Mustafa ULA

Response.buffer - flush
114

Frat niversitesi - Mustafa ULA

Response.end
115

Frat niversitesi - Mustafa ULA

Response.expires
116

Frat niversitesi - Mustafa ULA

Response.Charset
117

Frat niversitesi - Mustafa ULA

Response.Charset
118

Frat niversitesi - Mustafa ULA

119

Request.form

Frat niversitesi - Mustafa ULA

120

Request.form

Frat niversitesi - Mustafa ULA

Request.QueryString
121

5.asp

5_islem.asp

Frat niversitesi - Mustafa ULA

Request.QueryString
122

Frat niversitesi - Mustafa ULA

Request.ServerVariables
123

Frat niversitesi - Mustafa ULA

Request.ServerVariables
124

Frat niversitesi - Mustafa ULA

Frat niversitesi - Mustafa ULA

SERVER

125

ASP CreateObject Method


126

Sunucuda

tanml kompanentleri asp dosyasnda


kullanlmas iin kullanlr.

<%
Set cn=Server.CreateObject(ADODB.Connection")
%>

Frat niversitesi - Mustafa ULA

ASP Execute Method


127

Execute ile arlan dosyay sunucuda altrr. HTML olarak asl asp dosyasna
ekler.
Dosya1.asp:
<%
response.write(Buras Dosya 1!<br />")
Server.Execute("Dosya2.asp")
response.write(Dosya 1e geri dndm!")
%>

Dosya.asp:
<%
response.write("Buras Dosya 2!<br />")
%>

Ekran kts:

Buras Dosya 1!
Buras Dosya 2!
Dosya 1e geri dndm!

Frat niversitesi - Mustafa ULA

ASP MapPath Method


128

Dosya adresini geri dndrr.

<%
response.write(Server.MapPath("test.asp") & "<br />")
response.write(Server.MapPath("script/test.asp") & "<br />")
response.write(Server.MapPath("/script/test.asp") & "<br />")
response.write(Server.MapPath("\script") & "<br />")
response.write(Server.MapPath("/") & "<br />")
response.write(Server.MapPath("\") & "<br />")
%>

Ekran kts:
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script\script\test.asp
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script
c:\inetpub\wwwroot
c:\inetpub\wwwroot Frat niversitesi - Mustafa ULA

ASP URLEncode Method


129

<%
response.write(Server.URLEncode("http://www.w3schools.com"))
%>
Ekran kts:
http%3A%2F%2Fwww%2Ew3schools%2Ecom

Frat niversitesi - Mustafa ULA

ASP HTMLEncode Method


130

<%
response.write(Server.HTMLEncode("The image tag: <img>"))
%>
Ekran kts:
The image tag: &lt;img&gt;
Web browser kts :
The image tag: <img>

Frat niversitesi - Mustafa ULA

Rastgele Say
<%
Dim TesadufiSayi
Randomize
TesadufiSayi = Rnd

%>

Fonksiyonlar
<%
Function YaziTura
Dim ParaAt
Randomize
ParaAt = Int(Rnd * 2) + 1
If ParaAt = 1 Then
YaziTura = "Yaz"
Else
YaziTura = "Tura"
End If

End Function
%>
Bu fonksiyonu, ASP programnn herhangi bir yerinden, yle bir yntemle arabilir; ve verecei sonucu
programn akna uygun ekilde kullanabilirsiniz:
<%
NeGeldi = YaziTura
Response.Write NeGeldi
%>

subrutins
<%
Sub YaziTura()
Dim ParaAt
Randomize
ParaAt = Int(Rnd * 2) + 1
If ParaAt = 1 Then
Response.Write "Yaz"
Else
Response.Write "Tura"
End If

End Sub
%>
Sub, elde edecei deeri kendisi kullanacak ve bittii anda kontrol
programa geri dnecektir. Geriye deer dndermez.

Frat niversitesi - Mustafa ULA

ASP FILESYSTEM
OBJECT DOSYA VE
KLASR ILEMLERI

134

Asp Dosya Yazma


135

<HTML>

<HEAD>

<TITLE>ASP ILE DOSYA YAZMA</TITLE>

<META http-equiv="content-type" content="text/html; charset=ISO-8859-9">

<META http-equiv="Content-Type" content="text/html; charset=windows-1254">

</HEAD>

<BODY>

<%

Dim YaziFSO, yaz

Set YaziFSO = CreateObject("Scripting.FileSystemObject")

Set yaz = YaziFSO.CreateTextFile("c:\yazi_deneme.txt",True)

yaz.WriteLine("Bu bir denemedir.")

yaz.Close

%>

<H2><CENTER>Bu Web sayfas sabit diske yaz yazdrr!!

<BR>imdi C: srcsnde yazi_deneme.txt adl bir dosya olmas gerekir!

<BR>Ltfen bakar msnz?</H2></CENTER>

</BODY>

</HTML>

Frat niversitesi - Mustafa ULA

Asp Dosya Silme


136

<%

Dim DosyaSistemi

Set DosyaSistemi =
CreateObject(Scripting.FileSystemObject)

DosyaSistemi.DeleteFile c:\belgelerim\test.*

%>

Frat niversitesi - Mustafa ULA

Asp Dosya Kopyalama


137

Dim DosyaSistemi

Set DosyaSistemi = CreateObject(Scripting.FileSystemObject)

DosyaSistemi.CopyFile c:\belgelerim\*.*, c:\yedekler\

Frat niversitesi - Mustafa ULA

Metin Dosyasn Okuma


138

<HTML>
<HEAD>

<TITLE>ASP ILE DOSYADAN METN OKUMA</TITLE>


<META http-equiv="Content-Type" content="text/html; charset=windows-1254">

</HEAD>

<BODY>

<%

Dim DosyaSistemi, MetinDosyasi, Satir

Set DosyaSistemi = CreateObject("Scripting.FileSystemObject")

Set MetinDosyasi = DosyaSistemi.OpenTextFile("c:\yazi_deneme.txt",1, 0)

Do

Satir = MetinDosyasi.ReadLine
%>
<%=Satir%>
<%

Loop Until MetinDosyasi.AtEndOfStream

MetinDosyasi.Close

%>
</BODY>

</HTML>

Frat niversitesi - Mustafa ULA

ASP FileSystemObject Object


139
BuildPath
CopyFile
CopyFolder
CreateFolder
CreateTextFile
DeleteFile
DeleteFolder
DriveExists
FileExists
FolderExists
GetAbsolutePathName

Appends a name to an existing path


Copies one or more files from one location to another
Copies one or more folders from one location to another
Creates a new folder
Creates a text file and returns a TextStream object that can be used to read from, or
write to the file
Deletes one or more specified files
Deletes one or more specified folders
Checks if a specified drive exists
Checks if a specified file exists
Checks if a specified folder exists
Returns the complete path from the root of the drive for the specified path

GetBaseName
GetDrive
GetDriveName
GetExtensionName

Returns
Returns
Returns
Returns

GetFile
GetFileName

Returns a File object for a specified path


Returns the file name or folder name for the last component in a specified path

GetFolder
GetParentFolderName

Returns a Folder object for a specified path


Returns the name of the parent folder of the last component in a specified path

GetSpecialFolder
GetTempName
MoveFile
MoveFolder
OpenTextFile

Returns the path to some of Windows' special folders


Returns a randomly generated temporary file or folder
Moves one or more files from one location to another
Moves one or more folders from one location to another
Opens a file
and niversitesi
returns a TextStream
object
that can be used to access the file
Frat
- Mustafa
ULA

the base name of a specified file or folder


a Drive object corresponding to the drive in a specified path
the drive name of a specified path
the file extension name for the last component in a specified path

Methods

ASP File Object


140
Property

Description

Attributes
DateCreated
DateLastAccessed
DateLastModified
Drive

Sets or returns the attributes of a specified file


Returns the date and time when a specified file was created
Returns the date and time when a specified file was last accessed
Returns the date and time when a specified file was last modified
Returns the drive letter of the drive where a specified file or folder resides

Name
ParentFolder
Path
ShortName

Sets or returns the name of a specified file


Returns the folder object for the parent of the specified file
Returns the path for a specified file
Returns the short name of a specified file (the 8.3 naming convention)

ShortPath

Returns the short path of a specified file (the 8.3 naming convention)

Size

Returns the size, in bytes, of a specified file

Type

Returns the type of a specified file

Method

Description

Copy

Copies a specified file from one location to another

Delete

Deletes a specified file

Move

Moves a specified file from one location to another

OpenAsTextStream

Opens a specified file and returns a TextStream object to access the file

Frat niversitesi - Mustafa ULA

ASP Folder Object


141
Property
Attributes

Description
Sets or returns the attributes of a specified folder

DateCreated

Returns the date and time when a specified folder was created

DateLastAccessed

Returns the date and time when a specified folder was last accessed

DateLastModified

Returns the date and time when a specified folder was last modified

Drive

Returns the drive letter of the drive where the specified folder resides

IsRootFolder

Returns true if a folder is the root folder and false if not

Name

Sets or returns the name of a specified folder

ParentFolder

Returns the parent folder of a specified folder

Path
ShortName

Returns the path for a specified folder


Returns the short name of a specified folder (the 8.3 naming convention)

ShortPath

Returns the short path of a specified folder (the 8.3 naming convention)

Size
Type

Returns the size of a specified folder


Returns the type of a specified folder

Method

Description

Copy

Copies a specified folder from one location to another

Delete

Deletes a specified folder

Move

Moves a specified folder from one location to another

CreateTextFile

Creates a new text file in the specified folder and returns a TextStream object to access
the file

Frat niversitesi - Mustafa ULA

Frat niversiesi - Mustafa ULA

142

SQL - DATABASE
( VERTABANI )

143

DATABASE ( VERTABANI )

Database(Veritaban), ksaca bilgiler topluluudur.


Bizler, bu bilgiyi deerlendirerek, hzl ve doru bir ekilde
ulaabilir ve deiiklik yapabiliriz...

inde bulunduumuz bilgi anda, database'ler her yerde


mevcuttur:

Kitapda belli bir kitab aradnzda, kitapnn kitap


database'ine eriiyorsunuz demektir.
Bankalar, tm parasal kaytlar kendi database'i zerinde
tutmaktadr.
Frat niversiesi - Mustafa ULA

144

Veritaban Oluturma ( MS Access )

Frat niversiesi - Mustafa ULA

145

Veritaban Oluturma ( MS SQL Server )

Frat niversiesi - Mustafa ULA

146

Tablo

Frat niversiesi - Mustafa ULA

147

Tablo lemleri ( MS Access )

Frat niversiesi - Mustafa ULA

Temel Kavramlar
148

Veritaban (Database) : erisinde tablolar


barndrr.
Tablo (Table): En temel yapdr. Mantksal olarak
her olay veya nesne iin bir tablo tanmlamak
gerekebilir. Satr ve stnlardan meydana gelir.
Alan (Field) : Tablonun stunlardr. Her alan
nesne veya olayn bir zelliini belirtir.
Kayt (Row) : Tablonun her bir satrdr.

Frat niversiesi - Mustafa ULA

Temel Kavramlar - II
149

Birincil Anahtar

(Primary Key): Nesnenin veya


olayn tekil olan bir zellii PK olarak seilir.
ndeksleme ve sralama gibi tm ilemler bu
alan zerinden yaplr.
Yabanc Anahtar (Foreign Key): ki tablo
arasnda iliki kurmak iin kullanlr.
Alan Tipleri : Tam say, Gerek say,
Alfanumerik, Metin, Tarih, Mantksal

Frat niversiesi - Mustafa ULA

150

OGR_NO (PK) AD
5047
Ahmet

SOYAD
Kurban

SINIF
3

5027

Mehmet

apsz

5185

Burak

Sarca

ID (PK)
1
2
3
4
5

OGR_NO (FK) DERS_KOD


5047
BM301
5047
BM303
5047
BM308
5025
BM301
ULA
5025 Frat niversiesi - Mustafa
BM306

Frat niversiesi - Mustafa ULA

SQL

151

Select
152

Select * from TABLO where id=1 order by ad


Where
Order by
Count
Max
Sum
Union
Distinct
desc asc
Top

Frat niversiesi - Mustafa ULA

where
153

Like

Between

SELECT kolon
FROM tablo
WHERE kolon LIKE a%
SELECT kolon
FROM tablo
WHERE kolon
BETWEEN deger1 AND deger2

And
Or
Frat niversiesi - Mustafa ULA

Insert
154

Insert into (kolon1,kolon2,kolon3) values


(veri1,veri2,veri3)
P_Id

LastName FirstName Address

City

Hansen

Ola

Timoteivn 10

Sandnes

Svendson

Tove

Borgvn 23

Sandnes

Pettersen

Kari

Storgt 20

Stavanger

INSERT INTO Persons


VALUES (4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')

P_Id

LastName

FirstName Address

City

Hansen

Ola

Timoteivn 10

Sandnes

Svendson

Tove

Borgvn 23

Sandnes

Pettersen

Kari

Storgt 20

Stavanger

Nilsen

Johan

Bakken 2

Stavanger

Frat niversiesi - Mustafa ULA

Update
155

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
P_Id
LastName
FirstName

Address

City

Hansen

Ola

Timoteivn 10

Sandnes

Svendson

Tove

Borgvn 23

Sandnes

Pettersen

Kari

Storgt 20

Stavanger

Nilsen

Johan

Bakken 2

Stavanger

Tjessem

Jakob

UPDATE Persons
SET Address='Nissestien 67', City='Sandnes'
WHERE LastName='Tjessem' AND FirstName='Jakob'
P_Id
LastName FirstName Address
City
1

Hansen

Ola

Nissestien 67

Sandnes

Svendson

Tove

Nissestien 67

Sandnes

Pettersen

Kari

Nissestien 67

Sandnes

Nilsen
Johan
Nissestien 67
Frat niversiesi - Mustafa ULA
Tjessem
Jakob
Nissestien 67

Sandnes

Sandnes

Delete
156

DELETE FROM table_name


WHERE some_column=some_value
DELETE FROM Persons
WHERE LastName='Tjessem' AND FirstName='Jakob'

P_Id

LastName

FirstName

Address

City

Hansen

Ola

Timoteivn 10

Sandnes

Svendson

Tove

Borgvn 23

Sandnes

Pettersen

Kari

Storgt 20

Stavanger

Nilsen

Johan

Bakken 2

Stavanger

Frat niversiesi - Mustafa ULA

SQL Alias
157

SELECT kolon AS alias_ad


FROM tablo

Frat niversiesi - Mustafa ULA

158

SELECT DISTINCT column_name(s)


FROM table_name
P_Id

LastName

FirstName Address

City

Hansen

Ola

Timoteivn 10

Sandnes

Svendson

Tove

Borgvn 23

Sandnes

Pettersen

Kari

Storgt 20

Stavanger

City
Sandnes
Stavanger

Frat niversiesi - Mustafa ULA

SQL JION
159

Persons
P_Id

LastName

FirstName

Address

1
2
3

Hansen
Svendson
Pettersen

Ola
Tove
Kari

Timoteivn 10 Sandnes
Borgvn 23
Sandnes
Storgt 20
Stavanger

Orders
O_Id

OrderNo

P_Id

77895

44678

22456

24562

34764

15
Frat niversiesi - Mustafa ULA

City

SQL JION
160

SQL Inner Join


SELECT

Persons.LastName, Persons.FirstName,
Orders.OrderNo
FROM Persons
INNER JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

LastName

FirstName

OrderNo

Hansen

Ola

22456

Hansen

Ola

24562

Pettersen

Kari

77895

Pettersen

Kari

44678

Frat niversiesi - Mustafa ULA

SQL JION
161

SQL Left Join


SELECT

Persons.LastName, Persons.FirstName,
Orders.OrderNo
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

LastName

FirstName

OrderNo

Hansen

Ola

22456

Hansen

Ola

24562

Pettersen

Kari

77895

Pettersen

Kari

44678

Svendson

Tove
Frat niversiesi - Mustafa ULA

SQL JION
162

SQL Right Join


SELECT

Persons.LastName, Persons.FirstName,
Orders.OrderNo
FROM Persons
RIGHT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

LastName

FirstName

OrderNo

Hansen

Ola

22456

Hansen

Ola

24562

Pettersen

Kari

77895

Pettersen

Kari

44678
34764
Frat niversiesi - Mustafa ULA

SQL Functions
163

AVG() Function
SELECT AVG(column_name)

FROM table_name

COUNT() Function
SELECT

COUNT(column_name) FROM
table_name

MAX() Function
SELECT

MAX(column_name) FROM table_name

SUM() Function
SELECT

SUM(column_name) FROM table_name


Frat niversiesi - Mustafa ULA

SQL Functions
164

UCASE() Function

LCASE() Function

SELECT LCASE(column_name) FROM table_name

ROUND() Function

SELECT UCASE(column_name) FROM table_name

SELECT ROUND(column_name,decimals) FROM


table_name

NOW() Function

SELECT NOW() FROM table_name


Frat niversiesi - Mustafa ULA

165

Function

Description

GETDATE()

Returns the current date and time

DATEPART()

Returns a single part of a date/time

DATEADD()

Adds or subtracts a specified time interval from a date

DATEDIFF()

Returns the time between two dates

CONVERT()

Displays date/time data in different formats

Frat niversiesi - Mustafa ULA

Frat niversiesi - Mustafa ULA

166

SQL
STRUCTURED QUERY
LANGUAGE
( YAPSAL SORGULAMA DILI )

167

SQL

SQL, Balantl veritabanlarnn tanmlanmas, deitirilmesi ,


sorgulanmas amacyla kullanlr.
SQL dilini kullanarak veritabanmzda ilemler yapabileceimiz pek ok DBMS (Database Management System Veritaban Ynetim Sistemi) bulunmaktadr.
Bazlar MySQL, Interbase, Sybase, PostgreSQL olarak
saylabilir.
Bu programlar veritabannn oluturulmas ve ynetimi
amaldr.
Genelde verinin son kullancya ulatrlmasnda kullanlan
arayzler farkl programlama dilleri tarafndan yaplmaktadr.
Bunlardan ASP ve PHP web arayz,
C++ Builder ve VS.NET de PC arayz hazrlamakta
kullanlanlara rnek olarak verilebilir.
Frat niversiesi - Mustafa ULA

168

SQL SELECT *

Frat niversiesi - Mustafa ULA

169

SQL SELECT ALAN

Frat niversiesi - Mustafa ULA

170

SQL ORDER BY

Frat niversiesi - Mustafa ULA

171

SQL ORDER BY DESC

Frat niversiesi - Mustafa ULA

SQL WHERE
172

Frat niversiesi - Mustafa ULA

ASP ILE
VERITABAN
ILEMLERI

ActiveX Veri Eriim (ADO) Nesneleri

ASP sayfalarnz Access,Paradox,SQL Server,Oracle gibi


veritabanlarna eriebilir, bunlardan veri okur ve veri
yazabilir.
ASP bunu ADO (ActiveX Data Objects) teknolojisi
sayesinde gerekletirir.
ADO Microsoftun gelitirdii bir teknolojidir.
ADO ,herhangi bir veritabanna gei salayan bir
program inrtafacei (arayz) dir.

ActiveX Veri Eriim (ADO) Nesneleri

ADO , PWS veya IIS kurulurken otomatik olarak


makinenize yklenir.
ASP , ODBC (Open Data Base Connectivity / Ak
Veritaban Balants) zellii olan tm veritabanlar ile
balantya geebilir.

ODBC (Open Data Base Connectivity)

Ak Veritaban Balants

DSNsiz Access Balants

DSNsiz SQL Server Balants

Connection (Veritabanna balant)

Connection ile veritabanna balant salanr.


DSN (Data Source Name )

Recordset (Kayt dizisi)

Balant kurulan veritaban zerinde ilemler yapmak iin


Recordset kullanlr.
Balant.Execute (icra edilecek komut)

Recordset

Recordset.MoveNext

Recordset.MoveNext

Listeleme

Recordset.AddNew

Recordset.Update

Recordset.Delete

CLOSE - NOTHING

SQL INSERT

SQL UPDATE

SQL DELETE

Frat niversitesi - Mustafa ULA - (2010)

ASP MS ACCESS
Okt. Mustafa ULA
mulas@firat.edu.tr

INTERNET TABANLI
PROGRAMLAMA
Frat niversitesi Enformatik Blm - 2010

Vous aimerez peut-être aussi