在线视频网打开问题,很奇怪。。大哥大姐进来看看吧。求求你们了
不知道什么问题。play.aspx是播放页面。如果进到网站不登陆看不了电影的,要登陆,进去play.aspx,动了但是读取不了电影。(后来我发现不要关掉上次打开的play.aspx,然后再在vs2008里再按一次生成,这样就能播放,不知道什么问题。帮帮我这个可怜的娃吧。。我都弄2天了。。public partial class Play : System.Web.UI.Page
{
string id;
string uid;
SqlConnection con = DB.getConnection();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["UserID"] == null)
{
Response.Write("<script laguage='javascript'>alert('请先登录!');window.location.href('User/Login.aspx')</script>");
}
else
{
id = Request.QueryString["ID"];
this.Bind();
}
}
try
{
id =Request.QueryString["ID"];
SqlCommand cmd = new SqlCommand("select *from Movies where MovieID='"+id+"'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["path"] = dr["MoviePath"].ToString ();
}
dr.Close();
con.Close();
}
catch (Exception e1)
{
Response.Write(e1.Message);
}
}
protected void Bind()
{
SqlDataAdapter sda = new SqlDataAdapter("select * from Comments where MovieID='"+id+"'", con);
DataSet ds = new DataSet();
sda.Fill(ds,"Comment");
this.GridView1.DataSource = ds.Tables["Comment"].DefaultView;
if (ds.Tables["Comment"].Rows.Count < 0)
{
GridView1.Visible = false;
}
GridView1.Visible = true;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Session["UserID"] != null && Session["RoleID"] != null)
{
try
{
uid = Session["UserID"].ToString();
string content = this.TextBox5.Text;
string title = this.TextBox4.Text;
DateTime dt = DateTime.Now;
con.Open();
SqlCommand cmd = new SqlCommand("insert into Comments(MovieID,UserID,CommentContent,CommentTitle,AddDate) values('" + id + "','" + uid + "','" + content + "','" + title + "','" + dt + "')", con);
cmd.ExecuteNonQuery();
con.Close();
this.Bind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
else
{
this.Label4.Visible = true;
this.Label4.Text = "您还没有登录!";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox5.Text = "";
TextBox4.Text = "";
}
我第一次在这里发贴,不知道有没有积分。。帮帮我吧。 --------------------编程问答-------------------- 我的QQ:328427330 。。。能帮帮我吗。。
--------------------编程问答-------------------- --------------------编程问答-------------------- 不好意思。。其实不长。。我发得太长了。。
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["UserID"] == null)
{
Response.Write("<script laguage='javascript'>alert('请先登录!');window.location.href('User/Login.aspx')</script>");
}
else
{
id = Request.QueryString["ID"];
this.Bind();
}
}
try
{
id =Request.QueryString["ID"];
SqlCommand cmd = new SqlCommand("select *from Movies where MovieID='"+id+"'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["path"] = dr["MoviePath"].ToString ();
}
dr.Close();
con.Close();
}
catch (Exception e1)
{
Response.Write(e1.Message);
}
}
protected void Bind()
{
SqlDataAdapter sda = new SqlDataAdapter("select * from Comments where MovieID='"+id+"'", con);
DataSet ds = new DataSet();
sda.Fill(ds,"Comment");
this.GridView1.DataSource = ds.Tables["Comment"].DefaultView;
if (ds.Tables["Comment"].Rows.Count < 0)
{
GridView1.Visible = false;
}
GridView1.Visible = true;
GridView1.DataBind();
}
补充:.NET技术 , ASP.NET