我有一个带有自动生成列的基础网格我如何从后面的代码中为其分配一个存储的 proc 结果
<ig:WebScriptManager ID="WebScriptManager1" runat="server"></ig:WebScriptManager>
<ig:WebDataGrid ID="EntityGrid" runat="server" Width="100%">
<Behaviors>
<ig:Sorting>
</ig:Sorting>
</Behaviors>
</ig:WebDataGrid>
后面的代码是
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
EntityName.Text = DropDownList1.SelectedItem.Text;
string @RegardingObjectName = DropDownList1.SelectedItem.Text.Trim();
String strConnString = ConfigurationManager.ConnectionStrings["LiveLeaseConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "p_DataList_ByRegardingObject";
cmd.Parameters.AddWithValue("@RegardingObjectName", @RegardingObjectName);
cmd.Connection = con;
try
{
con.Open();
EntityGrid.DataSource = cmd.ExecuteReader();
EntityGrid.DataBind();
我需要将实体作为参数传递给存储过程。我怎么能在这里做到这一点?
我收到读者关闭错误