| | |
picture saving in database. problem
![]() |
hi.. i tried to put picture on our system. in the employee form.. but i dont know the exact step on how.
i have here a code for opening the picture.. but i dont know how to save it in my database together with the information of the employee... here my code
cd.Filter = "PictureFile(*.jpg,*.bmp,*.gif)|*.jpg|*.gif|*.bmp|"
cd.ShowOpen
Image1.Picture = LoadPicture(cd.FileName)
i tried to use a field with an oleobject but i dont know how to work well..
this my saving procedure
Sub saverecord()
rsemployee.AddNew
rsemployee.Fields("EmployeeID") = txt1.Text
rsemployee.Fields("EmployeeName") = txt2.Text
rsemployee.Fields("EmployeePosition") = txt3.Text
rsemployee.Fields("Address") = txt4.Text
rsemployee.Fields("Age") = txt5.Text
rsemployee.Fields("Gender") = txt6.Text
rsemployee.Fields("PhoneNo") = txt7.Text
rsemployee.Fields("picture") = cd.FileName
rsemployee.Update
End Sub
i need an clear stepss...kindly help me....
thxxxxxxx
jaasaria
i have here a code for opening the picture.. but i dont know how to save it in my database together with the information of the employee... here my code
cd.Filter = "PictureFile(*.jpg,*.bmp,*.gif)|*.jpg|*.gif|*.bmp|"
cd.ShowOpen
Image1.Picture = LoadPicture(cd.FileName)
i tried to use a field with an oleobject but i dont know how to work well..
this my saving procedure
Sub saverecord()
rsemployee.AddNew
rsemployee.Fields("EmployeeID") = txt1.Text
rsemployee.Fields("EmployeeName") = txt2.Text
rsemployee.Fields("EmployeePosition") = txt3.Text
rsemployee.Fields("Address") = txt4.Text
rsemployee.Fields("Age") = txt5.Text
rsemployee.Fields("Gender") = txt6.Text
rsemployee.Fields("PhoneNo") = txt7.Text
rsemployee.Fields("picture") = cd.FileName
rsemployee.Update
End Sub
i need an clear stepss...kindly help me....
thxxxxxxx
jaasaria
Last edited by jaasaria; Jan 30th, 2008 at 9:21 am.
i guest u want to save path of the picture.
this way is the easiest. but you must to put the picture on one folder. don't try to move the picture that you was saved it. if you move the picture, you will get an error..
this way is the easiest. but you must to put the picture on one folder. don't try to move the picture that you was saved it. if you move the picture, you will get an error..
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Jan 2008
Posts: 1
Reputation:
Solved Threads: 0
Check this out,
http://vbcity.com/forums/faq.asp?fid...ase&#TID148279
http://vbcity.com/forums/faq.asp?fid...ase&#TID148279
Last edited by ptolchin; Jan 30th, 2008 at 3:05 pm. Reason: Whole Url wasnt showing
hi jaasaria,
>>can you give me the exact process??
what of exact process?
are u have visiting the site from ptolchin?
in there you can see the faq about this thread.
>>can you give me the exact process??
what of exact process?
are u have visiting the site from ptolchin?
in there you can see the faq about this thread.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
Try to use this sample code
vb Syntax (Toggle Plain Text)
Dim CN As New ADODB.Connection Dim RS As ADODB.Recordset Dim DataFile As Integer, Fl As Long, Chunks As Integer Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As String Private Const ChunkSize As Integer = 16384 Private Const conChunkSize = 100 Private Sub cmdSave_Click() CN.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Pubs;Data Source=Test" Dim strSQL As String strSQL = "SELECT * FROM pub_info where pub_id = '9999'" RS.Open strSQL, CN, adOpenForwardOnly, adLockOptimistic RS.AddNew SavePicture RS.Update Set RS = Nothing Set RS = New Recordset End Sub Private Sub SavePicture() Dim strFileNm As String DataFile = 1 Open strFileNm For Binary Access Read As DataFile Fl = LOF(DataFile) ' Length of data in file If Fl = 0 Then Close DataFile: Exit Sub Chunks = Fl \ ChunkSize Fragment = Fl Mod ChunkSize ReDim Chunk(Fragment) Get DataFile, , Chunk() RS!logo.AppendChunk Chunk() ReDim Chunk(ChunkSize) For i = 1 To Chunks Get DataFile, , Chunk() RS!logo.AppendChunk Chunk() Next i Close DataFile End Sub
Share your Knowledge.
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- dynamically update pages (HTML and CSS)
- Programming Sag Really Need Help / Advice (ASP.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Crystal Report XI Problem
- Next Thread: Please help me!
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






