Z
zkai2000
Guest
Hi, aku ve menyimpan info profil saya bersama-sama dengan gambar.Mengapa itu tidak jadi ditampilkan dalam database (menggunakan Microsoft Access)?Gambar saya ditetapkan sebagai objek OLE di Microsoft Access
Ini adalah kode VB
rivate Sub cmdSave_Click ()savePicToDB picPhoto.Tag, rsUser ( "Foto")savePicToDB picFingerprint.Tag, rsUser ( "Sidik Jari")
rsUser.AddNewrsUser ( "Nama") = txtname.TextrsUser ( "IC Tidak") = txtIC.TextrsUser ( "Usia") = txtAge.TextrsUser ( "Jender") = txtGender.TextrsUser ( "Contact No") = txtContact.TextrsUser ( "Alamat") = txtAddress.TextrsUser ( "Email") = txtEmail.TextrsUser ( "Keterangan") = txtRemarks.Text
rsUser.Update
txtBoxLock (Benar)ctrlEnable (Benar)
cmdNew.SetFocusEnd Sub
Public Sub savePicToDB (ByVal picFile As String, ByVal fldPic Sebagai ADODB.Field)
Dim bBLOB () As ByteDim iNum As Integer
If (picFile <> "") Kemudian
iNum = FreeFile
Buka picFile Untuk Biner Sebagai # iNumRedIm bBLOB (FileLen (picFile))Dapatkan # iNum,, bBLOBClose # 1
'Simpan BLOBfldPic.AppendChunk bBLOBEnd If
End SubPublic Sub loadPicFromDB (ByVal fldPic Sebagai ADODB.Field, ByRef picTarget As PictureBox)
Dim sTempPic As StringDim lImgSize As LongDim lOffset As LongDim bChunck () As ByteDim iFile As IntegerConst CHUNKSIZE = 1000
sTempPic = App.Path & "\ temppic.jpg"Jika Len (Dir (sTempPic))> 0 ThenMembunuh sTempPicEnd If
iFile = FreeFile
Buka sTempPic Untuk Biner Sebagai # iFilelImgSize = fldPic.ActualSize
Do While lOffset <lImgSizebChunck () = fldPic.GetChunk (CHUNKSIZE)Letakkan # iFile,, bChunck ()lOffset = lOffset CHUNKSIZELoop
Close # iFile
Jika FileLen (sTempPic)> 0 ThenpicTarget.Picture = LoadPicture (sTempPic)LainpicTarget.Picture = NothingEnd If
Membunuh sTempPic
End SubDi mana masalahnya??
Thanks so much!!
Ini adalah kode VB
rsUser.AddNewrsUser ( "Nama") = txtname.TextrsUser ( "IC Tidak") = txtIC.TextrsUser ( "Usia") = txtAge.TextrsUser ( "Jender") = txtGender.TextrsUser ( "Contact No") = txtContact.TextrsUser ( "Alamat") = txtAddress.TextrsUser ( "Email") = txtEmail.TextrsUser ( "Keterangan") = txtRemarks.Text
rsUser.Update
txtBoxLock (Benar)ctrlEnable (Benar)
cmdNew.SetFocusEnd Sub
Public Sub savePicToDB (ByVal picFile As String, ByVal fldPic Sebagai ADODB.Field)
Dim bBLOB () As ByteDim iNum As Integer
If (picFile <> "") Kemudian
iNum = FreeFile
Buka picFile Untuk Biner Sebagai # iNumRedIm bBLOB (FileLen (picFile))Dapatkan # iNum,, bBLOBClose # 1
'Simpan BLOBfldPic.AppendChunk bBLOBEnd If
End SubPublic Sub loadPicFromDB (ByVal fldPic Sebagai ADODB.Field, ByRef picTarget As PictureBox)
Dim sTempPic As StringDim lImgSize As LongDim lOffset As LongDim bChunck () As ByteDim iFile As IntegerConst CHUNKSIZE = 1000
sTempPic = App.Path & "\ temppic.jpg"Jika Len (Dir (sTempPic))> 0 ThenMembunuh sTempPicEnd If
iFile = FreeFile
Buka sTempPic Untuk Biner Sebagai # iFilelImgSize = fldPic.ActualSize
Do While lOffset <lImgSizebChunck () = fldPic.GetChunk (CHUNKSIZE)Letakkan # iFile,, bChunck ()lOffset = lOffset CHUNKSIZELoop
Close # iFile
Jika FileLen (sTempPic)> 0 ThenpicTarget.Picture = LoadPicture (sTempPic)LainpicTarget.Picture = NothingEnd If
Membunuh sTempPic
End SubDi mana masalahnya??
Thanks so much!!