qq_25844033 2015-04-06 12:18 采纳率: 0%
浏览 2549

“/”应用程序中的服务器错误。

出现问题:
图片说明

原代码:

 public partial class Details : System.Web.UI.Page
{
    string id;
    protected void Page_Load(object sender, EventArgs e)
    {
        id = Request.QueryString["id"];
        //if (Session["UserID"] == null)
        //{
        //    Response.Write("<script language='javascript'>alert('请登录后再进行操作');window.location.href='User/Login.aspx';</script>");
        //}
        if (!this.IsPostBack)
        {
            Bind();
        }
    }

    public void Bind()
    {
       // string str = "Select * From movies where movieid ="+id + "";
        string str = "select * from Movies where MovieName  like '%" + Session["MovieName"].ToString() + "%'";
        SqlConnection con = DB.getConnection();
        DataSet ds = new DataSet();
        SqlDataAdapter sda = new SqlDataAdapter(str, con);
        sda.Fill(ds, "Movie");
        this.DataList1.DataSource = ds.Tables["Movie"].DefaultView;
        this.DataList1.DataBind();
    }
    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "Play")
        {
            string hit = (e.Item.FindControl("Label8") as Label).Text; //当前的点播次数
            string getmovieid = (e.Item.FindControl("Lable20") as Label).Text;//当前所选择的视频ID号
            int num = Convert.ToInt32(hit) + 1;
            SqlConnection con = DB.getConnection();
            if (con.State != ConnectionState.Open)
            {
                con.Close();
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("Update Movies set moviehit = " + num + " where movieid =" + getmovieid + "", con);
            cmd.ExecuteNonQuery();//执行更新的语句
            con.Close();
            Response.Redirect("Play.aspx?ID=" + getmovieid);


        }
    }
}
  • 写回答

6条回答 默认 最新

  • qq_25844033 2015-04-06 12:23
    关注

    网站功能是视频网站,点击视频图片应该跳转页面,但是出现以上问题,怎么修改呢?

    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料