c# - Insert an selected image from gridview to mysql -


i know how upload , insert images using fileupload toolbox control. time have insert selected gridview item(an image) mysql using asp.net. first select image gridview insert image 'image' table. problem mysql workbench can't open inserted image. predict inserted data not blob data. , think i'm missing basic concepts of image insert. codes given below. image data type blob. how can fix it? examples appriciated. thanks.

protected void imageinsert() { { mysqlconnection con = new mysqlconnection(constr); mysqlcommand cmd = new mysqlcommand("insert images(image) values ('"+checkbox().tostring()+"')", con); con.open(); int s1 = cmd.executenonquery(); if (s1 > 0) { imgup1.text = "image uploaded succesfully!"; } con.close(); } } private string checkbox() { string url=null; foreach (gridviewrow row in gvimages.rows) { checkbox chkbox = row.findcontrol("chkrow") checkbox; if (chkbox !=null && chkbox.checked) { image img = (image)row.cells[1].controls[1]; url = img.imageurl; } } return url; } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -