日期:2014-05-18  浏览次数:20513 次

求组,读取数据库图片
<td align="center" class="shenhong"><a class="shenhong" title='<%#Eval("videoTitle") %>' target=_blank href='play.aspx?id=<%#Eval("id") %>' >
  <%#operateMethod.interceptStr((string)Eval("videoTitle"),6) %>
  </a></td>  

//获取公告标题
  public string title;
  //获取公告内容
  public string content;
  //获取公告发布时间
  public string issuanceDate;
  protected void Page_Load(object sender, EventArgs e)
  {

  bindNew(); //调用自定义方法显示最新视频!
  bindHumour(); //调用自定义方法显示搞笑视频!
  bindCartoon(); //调用自定义方法显示动漫视频!
  bindFilm(); //调用自定义方法显示电影视频!
  bindSport(); //调用自定义方法显示体育视频!
  bindBulletin(); //调用自定义方法显示公告信息!

  }
  //绑定公告内容!!
  protected void bindBulletin()
  {
  //设置SQL语句查询公告信息
  string sqlSel = "select * from bulletin where id=1";
  //调用公共类中方法getRow并接收返回的SqlDataReader对象

   
  SqlDataReader sdr = operateData.getRow(sqlSel);
  sdr.Read();
  //获取公告标题
  title = sdr["title"].ToString();
  //获取公告内容
  content = sdr["content"].ToString();
  //获取公告发布日期
  issuanceDate = Convert.ToDateTime(sdr["issuanceDate"]).ToShortDateString();
  sdr.Close();
  }
  //绑定今日视频!!
  protected void bindNew()
  {
  string sqlSel = "select top 6 * from videoInfo where Auditing=1 ORDER BY videoDate desc";
  dlNewVideo.DataSource = operateData.getRows(sqlSel).DefaultView;
  dlNewVideo.DataBind();

  }

  //绑定搞笑视频!!
  protected void bindHumour()
  {
  string sqlSel = "select top 10 * from videoInfo where videoType='搞笑' and Auditing=1 order by videoDate desc";
  dlHumour.DataSource = operateData.getRows(sqlSel).DefaultView;
  dlHumour.DataBind();
  }
  //绑定动漫视频!!
  protected void bindCartoon()
  {
  string sqlSel = "select top 10 * from videoInfo where videoType='动漫' and Auditing=1 order by videoDate desc";
  dlCartoon.DataSource = operateData.getRows(sqlSel).DefaultView;
  dlCartoon.DataBind();
  }
  //绑定体育视频!!
  protected void bindSport()
  {
  string sqlSel = "select top 10 * from videoInfo where videoType='体育' and Auditing=1 order by videoDate desc";
  dlSport.DataSource = operateData.getRows(sqlSel).DefaultView;
  dlSport.DataBind();
  }
  //绑定电影视频!!
  protected void bindFilm()
  {
  string sqlSel = "select top 10 * from videoInfo where videoType='电影' and Auditing=1 order by videoDate desc";
  dlFilm.DataSource = operateData.getRows(sqlSel).DefaultView;
 dlFilm.DataBind();
  }

  编译器错误消息: CS0103: 当前上下文中不存在名称“operateData”
要怎么做呢??



------解决方案--------------------
缺少引用吧,operateData应该是一个封装好的方法,你把鼠标移动到operateData,应该会出来一个小图标,然后点击箭头选择引用相应的类就可以了