【发布时间】:2010-08-24 08:56:46
【问题描述】:
我有一个存储过程,它获取 Id=@id 的数据和从 gridview 传递到存储的 @id 我试图这样做,但我无法请任何人帮助我
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
using (SqlConnection con = Connection.GetConnection())
{
string Sql = "Select Logo From Model where Id=@Id";
SqlCommand com = new SqlCommand(Sql, con);
com.Parameters.Add(Parameter.NewInt("@Id", GridView1.SelectedDataKey));
com.CommandType = CommandType.Text;
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
string Img2 = dr["Logo"].ToString();
if (Img2 == System.DBNull.Value.ToString())
{
Img.Visible = false;
}
}
}
}
【问题讨论】:
标签: c#