<%
__header("Content-Type","text/html; charset=gb2312");
db_Open("/NandFlash/dbCfg.db3");

var sql="select s.*,k.Name as KName,t.Note as TNote,t.Name as TName,t.Port from tbSM s left join tbSMKind k on k.Kind=s.Kind left join tbSMType t on (t.Type=s.Type and t.Tag1=s.Tag1)";

if (port==1)
  db_QryAdv(sql+" where Port=1");
else if (port==3)
  db_QryAdv(sql+" where (Port=3 or Port=5)");
else if (port==4)
  db_QryAdv(sql+" where (Port=4 or Port=5)");
else if (port==6)
  db_QryAdv(sql+" where Port=6");
else
  write("{\"op\":\"err\",\"reccnt\":0}");
db_Close();
%>