请问这是什么问题,我应该怎么改,关于聊天室系统?
using System;using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MyChatRoom.BusinessLogicLayer;
public partial class MessageView2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = MessageControl.SearchTop10(true , Session["CurrentUserName"].ToString());//这一句出错了,不知这么改。错误提示是说
未将对象引用设置到对象的实例。但还是不懂,这个是来选取私聊内容的前十条信息的,公聊的代码跟这个一样,但却一点错都没有,郁闷!
if (ds != null)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
Response.Write("<font color=" + dr["Color"].ToString() + ">");
Response.Write(dr["CreateTime"].ToString());
Response.Write("" + dr["FromUserName"].ToString()+"");
Response.Write(dr["Emotion"].ToString());
Response.Write("对" + dr["ToUserName"].ToString());
Response.Write("说道:");
Response.Write(dr["ContentData"].ToString());
Response.Write("</font><br>");
}
}
}
}
[ 本帖最后由 鸿鹄 于 2010-4-22 16:23 编辑 ]