当前位置:编程学习 > asp >>

一个ASP(JScript)简单SQL语句构建“类”,同时支持客户端和服务器端执行的

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<%
var QuestStringBuilder = function(){
// 1->查询语句, 2->更新语句, 3->删除语句, 4->插入语句
var QuestType = 0;
var Fields = [];
var Values = [];
var Condition;
var PK;
var PkeySort;
var TableName;
var State = false;
var CLogic = " AND ";
var COperator = "=";
this.addField = function(Field,Value){
Fields.push(processField(Field));
Values.push(processValue(Value));
};
this.addCField = function(CField,CValue){
var sTemp = [];
if(Condition!=undefined&&Condition!=""){ sTemp.push(Condition); }
if(COperator!="LIKE"){
sTemp.push(processField(CField)+COperator+processValue(CValue));
}else{
sTemp.push(processField(CField)+" LIKE '%"+CValue+"%'"); }
Condition = sTemp.join(CLogic);
if(Condition==""){ Condition=sTemp.toString();}
};
this.Table = function(s){TableName = s;};
this.PKey = function(s){PK = processField(s);};
this.PKeyAsc = function(){PkeySort="ASC";};
this.PKeyDesc = function(){PkeySort="DESC";};
this.getSelect = function(){
QuestType = 1;
return result();
};
this.getUpdate = function(){
QuestType = 2;
return result();
};
this.getDelete = function(){
QuestType = 3;
return result();
};
this.getInsert = function(){
QuestType = 4;
return result();
};
this.clear = function(){
Fields = [];
Values = [];
PK = undefined;
PkeySort = undefined;
补充:asp教程,高级应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,