hi guys,
i have a table of badges that contains all badges ready to be printed for players the design of table is showed in the following picture

and here is the image of the gridview

i have a problem to export the image type to the sql file here is my code on button export click
protected void Button2_Click(object sender, EventArgs e)
{
String requete="";
ImagineBLL imagis = ImagineBLL.Instance;
BLLBadge badgis =BLLBadge.Instance;
FTHBEntities ctx = new FTHBEntities();
for (int i = 0; i < GVPlayer.Rows.Count; i++)
{
CheckBox CB1 = GVPlayer.Rows[i].FindControl("CB1") as CheckBox;
if(GVPlayer.Rows[i].Cells[9].Text=="Pret" && CB1.Checked==true)
{
int id_badge = Convert.ToInt32(GVPlayer.Rows[i].Cells[1].Text);
Badge b = badgis.GetBadgeByID(id_badge);
string imageName=GVPlayer.Rows[i].Cells[8].Text;
Byte[] H = b.Image;
requete += " INSERT [dbo].[Badge] ([id_badge], [CodeClub], [NomClub], [Saison], [NomPrenomJoueur], [NumLicence], [DateNaissance], [ImageName]) VALUES (" + GVPlayer.Rows[i].Cells[1].Text + "," + GVPlayer.Rows[i].Cells[2].Text + "," + GVPlayer.Rows[i].Cells[3].Text + "," + GVPlayer.Rows[i].Cells[4].Text + "," + GVPlayer.Rows[i].Cells[5].Text + "," + GVPlayer.Rows[i].Cells[6].Text + "," + GVPlayer.Rows[i].Cells[7].Text + "," + H + ")";
Badge x = ctx.Badges.Single(p => p.id_badge == id_badge);
x.Statut = "Printed";
ctx.SaveChanges();
}
}
if (!String.IsNullOrEmpty(requete))
{
Response.Clear();
//set the response token cookie to be the token sent in the form request
Response.SetCookie(new HttpCookie("token", Request.Form["token"]));
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=file.sql");
Response.ContentType = "application/octet-stream";
Response.Output.Write(requete);
Response.End();
GVPlayer.DataBind();
}
}
is there any solution thank you