给数据库名。js 不能用数据集函数 
var a=this.getValue();
if (a.toString().length==3){
	//查询零食商品档案
	var sql="sql(\"连接名\", \"select mc from table1 where bm='" + a+ "'\", 1, 1)"
	var jilu=FR.remoteEvaluate(sql)
	contentPane.setCellValue("B2",null,jilu)
}
else if (a.toString().length==7){
	//查询生鲜商品档案
	var sql="sql(\"连接名\", \"select mc from table2 where bm='" + a+ "'\", 1, 1)"
	var jilu=FR.remoteEvaluate(sql)
	contentPane.setCellValue("B2",null,jilu)
}
猜出来的逻辑,你试试