| | |
Save picture in access
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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 2008 access account add advanced application array basic beginner browser button buttons click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic employees excel exists fade filter forms generatetags html images input intel internet listview mobile module monitor mysql net number objects open panel pdf picturebox picturebox2 port position print printing printpreview problem regex reuse right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver storedprocedure survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





