How to save image(.jpg) file in database
-
I have a .jpg file on my desktop. How to save it in the database. so that i can use it in my report. Thanks
-
I have a .jpg file on my desktop. How to save it in the database. so that i can use it in my report. Thanks
you have to store the image in binary format. so that u can fetch from database
Tech_spidy
-
you have to store the image in binary format. so that u can fetch from database
Tech_spidy
ya i have little bit idea i want to take the image by using Html fileinputbox control and from the specified path,i want to retrieve only the filename(not path). and store that file(binary data) in one of my image field. can u give me some code for doing this...... my code is.................. Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click 'Dim str As String = Me.File1.Value() 'If InStr(str, ".jp") > 0 Then ' 'File1.PostedFile.InputStream() 'Else ' Exit Sub 'End If Dim myStream As Stream myStream = File1.PostedFile.InputStream Dim ImgLength As Int64 = File1.PostedFile.ContentLength Dim ImgBinaryData(ImgLength) As Byte Dim n As Int64 = myStream.Read(ImgBinaryData, 0, ImgLength) saveimage(ImgBinaryData) End Sub Public Sub saveimage(ByVal mImageFileData As Byte()) Try Dim myTable As DataTable Dim myRow As DataRow conn = New SqlConnection(constr) conn.Open() cmd = New SqlCommand("spr_insertImage", conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter("@ImageData", mImageFileData)) cmd.ExecuteNonQuery() conn.Close() Catch ex As Exception lblError.Text = ex.Message End Try End Sub but its not working...... any help
-
I have a .jpg file on my desktop. How to save it in the database. so that i can use it in my report. Thanks
Have you used the image datatype in database?
-
Have you used the image datatype in database?
ya i have used image datatype.... but after inserting i m getting in the database...