| | |
Save picture in access
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Dec 2006
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
hi all
I can anyone tel me how to save image in access database.& also hw to access image from database.I don't know how to start.plz reply
Private Sub KS_SaveImage()
Try
Dim KS_FO As New OpenFileDialog
KS_FO.Title = "Select Image"
KS_FO.Filter = "Images(jpeg)|*.jpeg"
KS_FO.ShowDialog(Me)
' now going to open selected file
Dim KS_FS As New FileStream(KS_FO.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim KS_BytesOFfile(KS_FS.Length - 1) As Byte
KS_FS.Read(KS_BytesOFfile, 0, KS_BytesOFfile.Length)
'DB properties
Dim DBpath As String = Application.StartupPath & "\KSimg.mdb"
Dim KS_Con As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBpath)
Dim Sqlstatment As String = "INSERT INTO tblImg ([img],[size]) VALUES (?,?)"
Dim Cmd As New System.Data.OleDb.OleDbCommand(Sqlstatment, KS_Con)
Cmd.Parameters.Add("@Pic", System.Data.OleDb.OleDbType.Binary, KS_FS.Length).Value = KS_BytesOFfile
Cmd.Parameters.Add("@FileSize", System.Data.OleDb.OleDbType.Numeric, 100).Value = KS_BytesOFfile.Length
KS_Con.Open()
Cmd.ExecuteNonQuery()
KS_Con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
![]() |
Similar Threads
- Is phpBB easy to hack? (Existing Scripts)
- fstream Tutorial (C++)
- picture in database file VB6 (Visual Basic 4 / 5 / 6)
- any MS Access experts!! (MS Access and FileMaker Pro)
- I have the aim virus too! (Viruses, Spyware and other Nasties)
- Problems with Directory.Move (C#)
- VB Script Format (Visual Basic 4 / 5 / 6)
- Wireless Internet is Terminated in an Abnormal Way!!! (Networking Hardware Configuration)
- Aurora, DrPmon, MHTMLRedir problems (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Removing First Line Of Text From multiline textbox
- Next Thread: Process monitor
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account application array basic beginner browser button buttons center check click code combo crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel listview module monitor net networking number open output panel passingparameters picturebox picturebox2 port print printing problem project regex right-to-left searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey tcp temperature text textbox timespan toolbox transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





