Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with using Microsoft Access database and VB as GUI

Status
Not open for further replies.

zkai2000

Member level 5
Joined
Jul 25, 2004
Messages
94
Helped
0
Reputation
0
Reaction score
2
Trophy points
1,286
Activity points
907
VB-to-Microsoft Access

Hi, I’ve save my profile info together with pictures. Why it didn’t show in my database (using Microsoft Access)? My pictures are set as OLE object in Microsoft Access

This is my VB codes:

Private Sub cmdSave_Click()
savePicToDB picPhoto.Tag, rsUser("Photo")
savePicToDB picFingerprint.Tag, rsUser("Fingerprint")

rsUser.AddNew
rsUser("Name") = txtname.Text
rsUser("IC No") = txtIC.Text
rsUser("Age") = txtAge.Text
rsUser("Gender") = txtGender.Text
rsUser("Contact No") = txtContact.Text
rsUser("Address") = txtAddress.Text
rsUser("Email") = txtEmail.Text
rsUser("Remarks") = txtRemarks.Text

rsUser.Update

txtBoxLock (True)
ctrlEnable (True)

cmdNew.SetFocus
End Sub

Public Sub savePicToDB(ByVal picFile As String, ByVal fldPic As ADODB.Field)

Dim bBLOB() As Byte
Dim iNum As Integer

If (picFile <> "") Then

iNum = FreeFile

Open picFile For Binary As #iNum
ReDim bBLOB(FileLen(picFile))
Get #iNum, , bBLOB
Close #1

' Store the BLOB
fldPic.AppendChunk bBLOB
End If

End Sub


Public Sub loadPicFromDB(ByVal fldPic As ADODB.Field, ByRef picTarget As PictureBox)

Dim sTempPic As String
Dim lImgSize As Long
Dim lOffset As Long
Dim bChunck() As Byte
Dim iFile As Integer
Const CHUNKSIZE = 1000

sTempPic = App.Path & "\temppic.jpg"
If Len(Dir(sTempPic)) > 0 Then
Kill sTempPic
End If

iFile = FreeFile

Open sTempPic For Binary As #iFile
lImgSize = fldPic.ActualSize

Do While lOffset < lImgSize
bChunck() = fldPic.GetChunk(CHUNKSIZE)
Put #iFile, , bChunck()
lOffset = lOffset + CHUNKSIZE
Loop

Close #iFile

If FileLen(sTempPic) > 0 Then
picTarget.Picture = LoadPicture(sTempPic)
Else
picTarget.Picture = Nothing
End If

Kill sTempPic

End Sub


Where is the problem??
Thanks so much!!
 

Re: VB-to-Microsoft Access

hi
i think vb an access are not to be compared
either are made to do sth specific
bye :eek:
 

Re: VB-to-Microsoft Access

nono..i use microsoft access as my database. VB as GUI.

so any info i key-in will be saved in access
 

Re: VB-to-Microsoft Access

You can go to www.planet-source-code.com to download source codes
on database access. AFAIK, it's fairly simple to manipulate AccessDB
with Visual Basic 6.

Why don't use XML, which is more accessible and more popular of course.
 

VB-to-Microsoft Access

That rite. You can fine the source code there or u can take a look at the access example where the interface is using VB too.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top