Krisha 0 Newbie Poster

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],) 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

Krisha 0 Newbie Poster

iam Krishantha From Sri Lanka.
i like to help you to data comunication through seriol port with VB
tell me what is you're prob;am.
and what is the perpase
thanks

Krisha

I need your help regarding serial communication in VB.

I can't able to sand OR receive the data in BYTE form.
(ie. 00 to FF)

There is no proper example in MSDN.
Can you tell me something in this matter?

Thanks
Kishor Soni:!: