一次下载两个附件的问题
一条记录包含两个附件,在gridview的GridView1_SelectedIndexChanged中要把这两个附件都下载下来,我的语句如下:但是在运行中却只能执行第一个,后面的不执行,什么原因?该如何处理???
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
//现场----------------------------------
string connstr = Session[ "MyConnectionString "].ToString();
string sql = "select fjnr,filetype,fjsize,filename from fj where tablename = 'info_zwpa ' and tablekeys1 = ' " + GridView1.SelectedDataKey[0].ToString() + " ' and tablekeys2 = ' " + GridView1.SelectedDataKey[1].ToString() + " ' and xh = 0 ";
SqlConnection connection = new SqlConnection(connstr);
SqlCommand command = new SqlCommand(sql, connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
Response.Buffer = true;
Response.Clear();
Response.ContentType = dr[ "filetype "].ToString();
Response.AddHeader( "Content-Disposition ", "attachment;filename= " + HttpUtility.UrlEncode(dr[ "filename "].ToString()));
Response.BinaryWrite((Byte[])dr[ "fjnr "]);
Response.Flush();
Response.End();
}
connection.Close();
//人员----------------------------------
string sql1 = "select fjnr,filetype,fjsize,filename from fj where tablename = 'info_zwpa ' and tablekeys1 = ' " + GridView1.SelectedDataKey[0].ToString() + " ' and tablekeys2 = ' " + GridView1.SelectedDataKey[1].ToString() + " ' and xh = 1 ";
SqlConnection connection1 = new SqlC