Hoşgeldin Misafir

Kod Gelişmiş IsNull Fonksiyonu

MiRaT

13 Kas 2017
2,077 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
ASP ile ADO bağlantısı yaparak veri okuduğumuzda fieldin değeri alana göre string, integer, bool veya null değer döndürebilir.-


Biz null değerini kontol etmek için IsNull fonksiyonunu kullanıyoruz.-
Bazen "" (boş string) değeri için de IsNull fonksiyonunun true değer döndürmesini isteriz, bu durum için şu fonksiyonu tanımlamamız yeterlidir.-


Kod:
Function Kontrol (deger)


         If IsNull(deger) Then Kontrol = True


ElseIf deger = "" Then


         Kontrol = True


Else


         Kontrol = False


End If


End Function


-Kullanım-
-

-Rs:- ADODB.RecordSet için;--


Kod:
If Kontrol(Rs("bilgi")) Then


     Response.Write "Değer geçerli değil!"


End If