濮阳杆衣贸易有限公司

主頁 > 知識庫 > 一個(gè)改進(jìn)的ASP生成SQL命令字符串類的代碼[已測]

一個(gè)改進(jìn)的ASP生成SQL命令字符串類的代碼[已測]

熱門標(biāo)簽:武穴地圖標(biāo)注 石家莊慧營銷外呼系統(tǒng) 創(chuàng)意電話機(jī)器人 世界地圖標(biāo)注了哪些城市 濟(jì)源電銷外呼系統(tǒng)線路 地圖標(biāo)注陽江 外呼線路批發(fā) 梧州市地圖標(biāo)注 java外呼系統(tǒng)是什么

復(fù)制代碼 代碼如下:

%
class SQLString
'************************************
'變量定義
'************************************
'sTableName ---- 表名
'iSQLType ----SQL語句類型:0-增加,1-更新,2-刪除,3-查詢
'sWhere ---- 條件
'sOrder ---- 排序方式
'sSQL ----值
Private sTableName,iSQLType,sWhere,sOrder,sSQL
'************************************
'類初始化/結(jié)束
'************************************
Private Sub Class_Initialize()
sTableName=""
iSQLType=0
sWhere=""
sOrder=""
sSQL=""
End Sub
Private Sub Class_Terminate()
End Sub
'************************************
'屬性
'************************************
'設(shè)置表名的屬性
Public Property Let TableName(value)
sTableName=value
End Property
'設(shè)置條件
Public Property Let Where(value)
sWhere=value
End Property
'設(shè)置排序方式
Public Property Let Order(value)
sOrder=value
End Property
'設(shè)置查詢語句的類型
Public property Let SQLType(value)
iSQLType=value
select case iSQLType
case 0
sSQL="insert into {*#}0 ({*#}1) values ({*#}2)"
case 1
sSQL="update {*#}0 set {*#}1={*#}2"
case 2
sSQL="delete from {*#}0 "
case 3
sSQL="select {*#}1 from {*#}0 "
end select
End Property
'************************************
'函數(shù)
'************************************
'增加字段(字段名稱,字段值)
Public Sub AddField(sFieldName,sValue)
select case iSQLType
case 0
sSQL=replace(sSQL,"{*#}1",sFieldName ",{*#}1")
sSQL=replace(sSQL,"{*#}2","" sValue ",{*#}2")
case 1
sSQL=replace(sSQL,"{*#}1",sFieldName)
sSQL=replace(sSQL,"{*#}2","" sValue ",{*#}1={*#}2")
case 3
sSQL=replace(sSQL,"{*#}1",sFieldName ",{*#}1")
End Select
End Sub
'修改的返回字符串值的函數(shù)
'返回SQL語句
Public Function ReturnSQL()
sSQL=replace(sSQL,"{*#}0",sTableName)
select case iSQLType
case 0
sSQL=replace(sSQL,",{*#}1","")
sSQL=replace(sSQL,",{*#}2","")
case 1
sSQL=replace(sSQL,",{*#}1={*#}2","")
case 3
sSQL=replace(sSQL,",{*#}1","")
end Select
if sWhere>"" and iSQLType>0 then
sSQL=sSQL " where " sWhere
end if
if sOrder>"" and iSQLType>0 then
sSQL=sSQL " order by " sOrder
end if
ReturnSQL=sSQL
End Function
'返回SQL語句
Public Function ReturnSQL1()
sSQL=replace(sSQL,"{*#}0",sTableName)
select case iSQLType
case 0
sSQL=replace(sSQL,",{*#}1","")
sSQL=replace(sSQL,",{*#}2","")
case 1
sSQL=replace(sSQL,",{*#}1={*#}2","")
case 3
sSQL=replace(sSQL,",{*#}1","")
end Select
if sWhere>"" and iSQLType>0 then
sSQL=sSQL " where " sWhere
end if
if sOrder>"" and iSQLType>0 then
sSQL=sSQL " order by " sOrder
end if
ReturnSQL=sSQL
End Function
'清空語句
Public Sub Clear()
sTableName=""
iSQLType=0
sWhere=""
sOrder=""
sSQL=""
End Sub
End class
%>
調(diào)用例子:
%
set a =new SQLString '創(chuàng)建類對象
a.TableName=" message " '設(shè)置表名為message
'a.where=" issend =9"
'a.order=" issend desc"
a.SQLType=0 '設(shè)置查詢類型為增加記錄
a.AddField " incept", "'2'"
a.AddField " sender ", "'%3%' "
a.AddField " title ", "#"now"#"
a.AddField " sender ", "5 "
a.AddField " content ", " 6 "
a.AddField " sendtime ", "7"
a.AddField " flag", 8
a.AddField " issend ", 9
Response.Write a.ReturnSQl
set a=nothing
%>
%
set a =new SQLString '創(chuàng)建類對象
a.TableName=" message " '設(shè)置表名為message
'a.where=" issend =9"
'a.order=" issend desc"
a.SQLType=0 '設(shè)置查詢類型為增加記錄
a.AddField " incept", "'2'"
a.AddField " sender ", "'%3%' "
a.AddField " title ", "#"now"#"
a.AddField " sender ", "5 "
a.AddField " content ", " 6 "
a.AddField " sendtime ", "7"
a.AddField " flag", 8
a.AddField " issend ", 9
Response.Write a.ReturnSQl
set a=nothing
%>
%
set a =new SQLString '創(chuàng)建類對象
a.TableName=" message " '設(shè)置表名為message
'a.where=" issend =9"
'a.order=" issend desc"
a.SQLType=0 '設(shè)置查詢類型為增加記錄
a.AddField " incept", "'2'"
a.AddField " sender ", "'%3%' "
a.AddField " title ", "#"now"#"
a.AddField " sender ", "5 "
a.AddField " content ", " 6 "
a.AddField " sendtime ", "7"
a.AddField " flag", 8
a.AddField " issend ", 9
Response.Write a.ReturnSQl
set a=nothing
%>

標(biāo)簽:來賓 迪慶 滁州 甘南 唐山 淮北 揭陽 南寧

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一個(gè)改進(jìn)的ASP生成SQL命令字符串類的代碼[已測]》,本文關(guān)鍵詞  一個(gè),改進(jìn),的,ASP,生成,SQL,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《一個(gè)改進(jìn)的ASP生成SQL命令字符串類的代碼[已測]》相關(guān)的同類信息!
  • 本頁收集關(guān)于一個(gè)改進(jìn)的ASP生成SQL命令字符串類的代碼[已測]的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    同仁县| 密云县| 通渭县| 沂南县| 昌宁县| 柏乡县| 远安县| 南木林县| 榆社县| 读书| 新干县| 买车| 黔南| 密山市| 大冶市| 利津县| 房产| 咸宁市| 东城区| 琼结县| 龙里县| 治多县| 叙永县| 休宁县| 新野县| 夏邑县| 绥德县| 余庆县| 伊金霍洛旗| 靖西县| 禄丰县| 淮南市| 临泽县| 苏尼特左旗| 杭锦旗| 平舆县| 白沙| 定结县| 崇明县| 江川县| 博客|