Home » questions » how to save image in vb.net into sql?

how to save image in vb.net into sql?

2006-08-15 03:44:11, Category: Programming & Design
pl. help save image using sql database how. some picture image save in data base by using vb.net. pl send source code and what type of datatype selete in image field(int or double or binary or byte) tell me.

Answers

  1. kartoos5050

    On 2006-08-15 04:00:56


    the following code which i m giving you is written in c# i hope you will understand it and will convert it in vb.net syntex and in DataBase take varchar with size 300 for saving the path in the DataBase in the following code i take an htmlInputfile controle of name "picField" string strUploafFileName=System.IO.Path.GetFileName(picField.PostedFile.FileName); string []ext=strUploafFileName.Split('.'); if(ext[1].Equals("gif") || ext[1].Equals("jpg") || ext[1].Equals("bmp") ) { strFileName=Server.MapPath ("give drive path where you want to save")+here you can give the unique id +"."+ext[1].ToString(); if(System.IO.File.Exists(strFileName)) { System.IO.File.Delete(strFileName); } picField.PostedFile.SaveAs(strFileName); }
  2. kryptonboy22

    On 2006-08-15 03:56:42


    guys here can help you! http://www.vbforums.com/forumdisplay.php?f=1