马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
减少客户内IT专业人才缺乏带来的影响。ASP的客户员工利用浏览器进入相关的应用软件,简单易用,无需专业技术支持。vbscript|语句|vbscript<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<%OptionExplicit%>
<%Response.Buffer=True%>
<%
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
///文件名:SQLBuilderForVbs
///感化:构建一些复杂的SQL语句,分离在提交表单时利用,能够较便利
///程式编写者:曾思源
///申明:复杂SQL语句构建“类”,VBS版,只需保存本正文段,不管是不是触及贸易,您能够恣意利用,转载或援用
///日期:2005-1-8
///_________________________________________________________________________________________________
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
%>
<%
OnErrorResumeNext
ClassQuestStringBuilder
PrivateobjFields
PrivatestrTableName
PrivatestrPKey
PrivatestrPKeySort
PrivatestrCondition
PrivateaContition()
PrivatestrOperator
PrivatestrLogic
PrivateblnState
/-----初始化-----/
PrivateSubClass_Initialize()
SetobjFields=Server.CreateObject("Scripting.Dictionary")
strTableName=Null
strPKey=Null
strPKeySort=Null
strCondition=Null
ReDimaContition(1)
strOperator="="
strLogic="AND"
blnState=False
EndSub
PrivateSubClass_Terminate()
SetobjFields=Nothing
strTableName=Null
strPKey=Null
strPKeySort=Null
strCondition=Null
EraseaContition
strOperator=Null
strLogic=Null
blnState=False
EndSub
/----字段名处置----/
PrivateFunctionProcessField(ByValsField)
ProcessField="["&sField&"]"
EndFunction
/-----字段值处置-----/
PrivateFunctionProcessValue(ByValsValue)
DimtmpType:tmpType=VarType(sValue)
SelectCasetmpType
Case2,3,4,5,11数字范例,布尔范例
ProcessValue=sValue
Case8字符范例
ProcessValue=""&Safe(sValue)&""
CaseElse别的范例
ProcessValue=""&Safe(sValue)&""
EndSelect
EndFunction
/-----综合处置-----/
PrivateFunctionProcess(ByRefobj,ByValstrType)
DimKeys:Keys=obj.Keys
DimItems:Items=obj.Items
DimintCount:intCount=obj.Count
Dimtmp()
ReDimtmp(1)
IfintCount>0Then
DimtmpArray(),I
ReDimtmpArray(intCount-1)
ForI=0TointCount-1
tmpArray(I)=Keys(I)&"="&Items(I)
Next
SelectCaseUCase(Trim(strType))
Case"UPDATE"
Process=Join(tmpArray,",")
Case"SELECT"
Process=Join(Keys,",")
Case"INSERT"
tmp(0)=Join(Keys,",")
tmp(1)=Join(Items,",")
Process=tmp
Erasetmp
EndSelect
ErasetmpArray
Else
SelectCaseUCase(Trim(strType))
Case"UPDATE"
Process=False
Case"SELECT"
Process="*"
Case"INSERT"
Process=tmp
EndSelect
EndIf
EndFunction
/-----小小的平安处置-----/
PrivateFunctionSafe(s)
Safe=Replace(s,"","")
EndFunction
/-----清空上一次输出的参数,但保存TableName-----/
PublicSubClear()
objFields.RemoveAll
strTableName=Null
strPKey=Null
strPKeySort=Null
strCondition=Null
EraseaContition
strOperator="="
strLogic="AND"
blnState=False
EndSub
/----天生查询语句----/
PublicFunctiongetSelect()
DimstrSQLTemplate:strSQLTemplate="SELECT{fields}FROM{table}{conditions}{orderby}{sort}"
strSQLTemplate=Replace(strSQLTemplate,"{fields}",Process(objFields,"SELECT"))
IfVarType(strTableName)=1ThenExitFunction
strSQLTemplate=Replace(strSQLTemplate,"{table}",strTableName)
IfVarType(strCondition)1AndstrCondition""Then
strSQLTemplate=Replace(strSQLTem</p>强大的可扩展性。ASP具有强大的扩展性,可以实现与多种网络、硬件设备的连接:通过专用的通讯线路远程接入企业;通过远程拨号服务器为远程拨号客户提供服务;通过WAP为移动电话互联网客户服务。 |