World Of Webmaster
Đăng nhập / Đăng ký
Account
Free for web
Check pagerank
Input check pager (Not http://)

Ext: blog.kai.vn
Check google pagerank
View HTML source
FUNCTION LIBRARY
HTML Tags Library
PHP Functions Library ASP Functions Library
ASP Functions EscapeApos
Chức năng: Chuyển đổi ký tự dùng trong SQL
Ngôn ngữ: asp - Nhóm: database
CÚ PHÁP
  escapedString = EscapeApos(inputString) 

Chuyển đổi các ký tự như " thành các ký tự thích hợp khi thực hiện truy vấn SQL để tránh lổi.

VÍ DỤ
<%
  dim name, id, sql, c
  
  '--- escape string
  name = EscapeApos(Request("name"))
  
  '--- ensure int
    id = CLng(Request("id"))
  
  '--- build sql
    sql = "UPDATE table1 SET name  = " & name & " WHERE ID = " & id
  
  '--- execute sql
  Set c = CreateObject("ADODB.Connection")
    c.Open "connstring"
      c.Execute sql
        c.Close
  Set c = Nothing
%> 
ASP Code
<%
  Function EscapeApos(ByVal input)
      If IsNull(input) Then
          EscapeApos = "NULL"
          Exit Function
      End If
  
      If IsEmpty(input) then
          EscapeApos = "NULL"
          Exit Function
      End If
  
      If Len(Trim(input)) = 0 Then
          EscapeApos = "NULL"
          Exit Function
      End If
  
      EscapeApos = "'" & Replace(input, "'", "''") & "'"
  End Function
%> 

CompactDB
DateDB
EscapeBit
EscapeDate
EscapeInt
MkDatabase
NoSQLInjection
Procedures
RecordCount
RecordCount2
Library ›› HTML Tag | PHP Function | ASP Function
Page : 806897
Online :
Visited : 370220
 
Liên h | Thêm vào Favorite | Gửi link qua e-mail | Thông tin website
Copright © 2009 KAI Blog
Code by BOINGOnline. Contact email : contact@kai.vn
Theme: default | classic |