关键字 'select' 附近有语法错误
publicDetailPagegetTopicInfoAndUserInfoById(Integertid){DetailPagedetail=null;Strings...
public DetailPage getTopicInfoAndUserInfoById(Integer tid) {
DetailPage detail = null;
String sql = "select tTopic,tContents,tPublishTime,tModifyTime,tId,tUid,tisend,tperson,tintro,tnum,tvendor,ttype,toublish,tdevelop,tmode"
+ "(select uName from userInfo where userInfo.uId = topicInfo.tuid) as tName,"
+ "(select uFace from userInfo where userInfo.uId = topicInfo.tuid) as tFace,"
+ "(select uRegTime from userInfo where userInfo.uId = topicInfo.tuid) as tRegTime,"
+ "(select uSex from userInfo where userInfo.uId = topicInfo.tuid) as tSex"
+ " from topicInfo where tid = ?";
try {
rs = dao.executeQuery(sql, new Object[] { tid });
if (rs != null && rs.next()) {
detail = new DetailPage();
//
detail.setContents(rs.getString("tContents"));
detail.setFace(rs.getString("tFace"));
detail.setModifytime(rs.getTimestamp("tModifyTime"));
detail.setName(rs.getString("tName"));
detail.setPublishtime(rs.getTimestamp("tPublishTime"));
detail.setRegtime(rs.getDate("tRegTime"));
detail.setTitle(rs.getString("tTopic"));
detail.setSex(rs.getBoolean("tSex"));
detail.setId(rs.getInt("tId"));
detail.setUid(rs.getInt("tUid"));
detail.setIsend(rs.getString("tisend"));
detail.setPerson(rs.getString("tperson"));
detail.setIntro(rs.getString("tintro"));
detail.setNum(rs.getInt("tunm"));
detail.setVendor(rs.getString("tvendor"));
detail.setType(rs.getString("ttype"));
detail.setPublish(rs.getString("tpublish"));
detail.setDevelop(rs.getString("tdevelop"));
detail.setMode(rs.getString("tmode"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
dao.closeResultSet();
dao.closeStatement();
dao.closeConnection();
}
return detail;
}
提示关键字 'select' 附近有语法错误 展开
DetailPage detail = null;
String sql = "select tTopic,tContents,tPublishTime,tModifyTime,tId,tUid,tisend,tperson,tintro,tnum,tvendor,ttype,toublish,tdevelop,tmode"
+ "(select uName from userInfo where userInfo.uId = topicInfo.tuid) as tName,"
+ "(select uFace from userInfo where userInfo.uId = topicInfo.tuid) as tFace,"
+ "(select uRegTime from userInfo where userInfo.uId = topicInfo.tuid) as tRegTime,"
+ "(select uSex from userInfo where userInfo.uId = topicInfo.tuid) as tSex"
+ " from topicInfo where tid = ?";
try {
rs = dao.executeQuery(sql, new Object[] { tid });
if (rs != null && rs.next()) {
detail = new DetailPage();
//
detail.setContents(rs.getString("tContents"));
detail.setFace(rs.getString("tFace"));
detail.setModifytime(rs.getTimestamp("tModifyTime"));
detail.setName(rs.getString("tName"));
detail.setPublishtime(rs.getTimestamp("tPublishTime"));
detail.setRegtime(rs.getDate("tRegTime"));
detail.setTitle(rs.getString("tTopic"));
detail.setSex(rs.getBoolean("tSex"));
detail.setId(rs.getInt("tId"));
detail.setUid(rs.getInt("tUid"));
detail.setIsend(rs.getString("tisend"));
detail.setPerson(rs.getString("tperson"));
detail.setIntro(rs.getString("tintro"));
detail.setNum(rs.getInt("tunm"));
detail.setVendor(rs.getString("tvendor"));
detail.setType(rs.getString("ttype"));
detail.setPublish(rs.getString("tpublish"));
detail.setDevelop(rs.getString("tdevelop"));
detail.setMode(rs.getString("tmode"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
dao.closeResultSet();
dao.closeStatement();
dao.closeConnection();
}
return detail;
}
提示关键字 'select' 附近有语法错误 展开
3个回答
展开全部
select tTopic,tContents,tPublishTime,tModifyTime,tId,tUid,tisend,tperson,tintro,tnum,tvendor,ttype,toublish,tdevelop,tmode"
+ "(select uName from userInfo where userInfo.uId = topicInfo.tuid) as tName,"
+ "(select uFace from userInfo where userInfo.uId = topicInfo.tuid) as tFace,"
+ "(select uRegTime from userInfo where userInfo.uId = topicInfo.tuid) as tRegTime,"
+ "(select uSex from userInfo where userInfo.uId = topicInfo.tuid) as tSex"
+ " from topicInfo
放在数据库里,,,,测试下嘛
+ "(select uName from userInfo where userInfo.uId = topicInfo.tuid) as tName,"
+ "(select uFace from userInfo where userInfo.uId = topicInfo.tuid) as tFace,"
+ "(select uRegTime from userInfo where userInfo.uId = topicInfo.tuid) as tRegTime,"
+ "(select uSex from userInfo where userInfo.uId = topicInfo.tuid) as tSex"
+ " from topicInfo
放在数据库里,,,,测试下嘛
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询