| | |
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 |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array assignment basic binary bing button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog firewall folder ftp google hardcopy image images insert isnumericfuntioncall listview login math memory mobile ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port print problemwithinstallation project reports" save savedialog searchbox serial soap sorting string table tcp temp text textbox timer toolbox trim update updown upload useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





