前台:
在删除/修改触发函数中添加sql进行查找
var str = "select agentCode from laagent where agentCode= '"+agentcode+"'";//sql查询语句
var tArr = easyExecSql(str);//执行sql
if(tArr == null ){ //查询结果为空给个提示
alert("修该的代理人不存在~");
return false;
}else {业务逻辑;}
后台:
方法一:sql查询 返回字符串
在数据处理阶段进行查询验证
ExeSQL exeSql = new ExeSQL();//new一执行sql对象
String lcgrpCont = exeSql.getOneValue("select agentcode from laagent where agentcode= '"+lcgrpContSchema.getAgentCode()+"'");//查询当前操作字段
System.out.println("--------------------"+lcgrpCont);
if(lcgrpCont == null || "".equals(lcgrpCont)){ //查询字段判空
return false;
}
方法二:sql查询 返回数组
ExeSQL exeSql = new ExeSQL();//查询对象
SSRS lcgrpCont = exeSql.execSQL("select grpcontno , agentcode from lcgrpcont where grpcontno = '"+lcgrpContSchema.getGrpContNo()+"'");
/* String tow = dd.GetText(1, 1); //取第一行第一列
int row = dd.MaxRow;*/
System.out.println("-------------------"+lcgrpCont.GetText(1, 1)+"-------"+lcgrpCont.GetText(1, 2)+"---"+lcgrpCont.MaxRow);
if(lcgrpCont == null || lcgrpCont.MaxRow == 0 ){//?没查着干嘛
return false;
}
for( int i=0;i<row;i++){//查询结果为多行 循环取出逐行字段值
String col = lcgrpCont.GetText(i, 1);
}