日期:2014-05-17 浏览次数:20440 次
public DataSet GetMessageInfoById(int id, int num)
{
string sqlStr = @"SELECT top @num RestaurantMessage.rmessageId as messageid, messageTime,messageContent,
RestaurantMessage.memberId as memberId,
memberNickName ,
memberHeadPhoto,
RestaurantMessageReply.messageReplyContent as messageReplyContent
FROM
[RestaurantMessage] left join [Member] on RestaurantMessage.memberid=Member.Memberid
left join RestaurantMessageReply on RestaurantMessage.rmessageId=RestaurantMessageReply.rmessageId
where [restaurantId]=@id order by RestaurantMessage.[rmessageId] desc";
SqlParameter[] sqlParas = {
new SqlParameter("@id",SqlDbType.NVarChar),
new SqlParameter("@num", SqlDbType.NVarChar)
};
sqlParas[0].Value = id;
sqlParas[1].Value = num;
return DbHelper.Query(sqlStr, sqlParas);
}