how to insert image in sql server 2008 in .net?
i am using below code
string str;
FileUpload img = (FileUpload)imgUpload;
Byte[] imgByte = null;
if (img.HasFile && img.PostedFile != null)
{
HttpPostedFile File = imgUpload.PostedFile;
imgByte = new Byte[File.ContentLength];
File.InputStream.Read(imgByte, 0, File.ContentLength);
}
str ="Insert into tblimg values ('"+imgByte.tostring()+"')";
it's not working
Sanjay KumarPosted Sep 23, 2013, 1:42 AM
FileUpload1
string FU,path;
if (FileUpload1.PostedFile.ContentLength > 0)
{
FU = Path.GetFileName(FileUpload1.FileName);
path = Server.MapPath("UploadPhoto") + "/" + FU;
FileUpload1.SaveAs(path);
}
Sanjay KumarPosted Sep 23, 2013, 1:29 AM
CREATE PROCEDURE [dbo].[insert_login]
(
@UserName [nvarchar](50),
@Password [nvarchar](50),
@image [varchar](50)
)
AS
Insert into Login values(@UserName,@Password,@image)
Sanjeeb LenkaPosted Sep 23, 2013, 1:14 AM