本文介绍了对ASP.NET中继器控件的怀疑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

这是我的按钮点击事件代码

protected void ButtonShowVideo_Click(object sender, EventArgs e)
{

        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand  cmd1 = new SqlCommand();
        conn.Open();
        cmd1.Connection = conn;
        cmd1.CommandType = CommandType.StoredProcedure;
        cmd1.CommandText = "Show_video16";
        cmd1.Parameters.Add("@ID", SqlDbType.Int).Value = TextBox1.Text;
        SqlDataAdapter da = new SqlDataAdapter(cmd1);
        //cmd1.Parameters.Clear();
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        da.Fill(dt);
        Repeater1.DataSource = cmd1.ExecuteReader();
        Repeater1.DataBind();
        conn.Close();
}



存储过程为:

CREATE PROCEDURE [dbo].[show_video16]
(
		@ID int

)
AS
declare @Video varbinary(max),
		@Video_Name nvarchar(50)

BEGIN
	select @Video=Video,@Video_Name =Video_Name from Videos where ID = @ID
END



我想在按钮单击事件期间将数据绑定到转发器控件中
,但不起作用,

解决方案



here is my button click event code

protected void ButtonShowVideo_Click(object sender, EventArgs e)
{

        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        SqlCommand  cmd1 = new SqlCommand();
        conn.Open();
        cmd1.Connection = conn;
        cmd1.CommandType = CommandType.StoredProcedure;
        cmd1.CommandText = "Show_video16";
        cmd1.Parameters.Add("@ID", SqlDbType.Int).Value = TextBox1.Text;
        SqlDataAdapter da = new SqlDataAdapter(cmd1);
        //cmd1.Parameters.Clear();
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        da.Fill(dt);
        Repeater1.DataSource = cmd1.ExecuteReader();
        Repeater1.DataBind();
        conn.Close();
}



The Stored Procedure is:

CREATE PROCEDURE [dbo].[show_video16]
(
		@ID int

)
AS
declare @Video varbinary(max),
		@Video_Name nvarchar(50)

BEGIN
	select @Video=Video,@Video_Name =Video_Name from Videos where ID = @ID
END



I want to bind the data in repeater control during button click event
,but its not working,

解决方案




这篇关于对ASP.NET中继器控件的怀疑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 18:21