关键字 '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' 附近有语法错误
展开
 我来答
苹果牛奶巧克力雪糕冰淇淋
2012-08-08 · TA获得超过254个赞
知道小有建树答主
回答量:519
采纳率:100%
帮助的人:242万
展开全部
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
放在数据库里,,,,测试下嘛
那夜小0i
2012-07-28 · TA获得超过154个赞
知道小有建树答主
回答量:442
采纳率:0%
帮助的人:253万
展开全部
你这个sql语句一句一句放到数据库里执行一遍你就知道了,这样问谁愿意看呀
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友8ac6d36fb
2012-07-31 · TA获得超过621个赞
知道小有建树答主
回答量:298
采纳率:0%
帮助的人:185万
展开全部
tid = ?

这里错了?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式