السلام عليكم اخواني
اخواني الاعزاء انا قريت موضوع ف المنتدى للعضو ()
عن كيفية اضافة صورة في قاعدة البيانات واسترجاعها
طبعا وطبقة الطريقه على برنامجي وضبط معي عملية الاضافة في القاعده
بس المشكله مو قادر استرجاع الصوره عن القيم بعملية البحث
علم باني انا اقوم بالبحث عن الشخص بادخال رقم بطاقته الشخصية ويظهر لي كافة معلوماته اوكيه بس الصوره ماتظهر
برغم انها موجوده في القاعده
عالما اني طريقتك في البرمجه تختلف ع طريقة العضوانا مستخدم المشروع من النوع vb enterprise edition controls
وهو مستخدم stander exe
ايضا انت مستخدم مكتبةADODB كذا
Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ App.Path & "\frend.mdb;Persist Security Info=False"
علما بان زر الاضافه عندي كذا
Private Sub saverec()
On Error Resume Next
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\frend.mdb;Persist Security Info=False"
cn.Open
'cn.Open
Set rs = cn.Execute("select * from medical_staff where sta_id=" & Text1(0) & "")
If Not rs.EOF Then
MsgBox "عفو انا هذا الرقم غير مسجل مسبقا", vbInformation
Text1(0).SetFocus
Exit Sub
End If
cn.Close
If Len(Text1(0)) = 0 Then
MsgBox "íÌÈ ÚÏã ÊÑß ÇáÍÞá ÝÇÑÛÇ"
Text1(0).SetFocus
Exit Sub
End If
If Len(Text1(1)) = 0 Then
MsgBox "íÌÈ ßÊÇÈÉ ÇÓã ÇáØÇáÈ"
Text1(1).SetFocus
Exit Sub
End If
cn.Open
Set rs = cn.Execute("select * from medical_staff where specialization=" & Text1(4) & "")
If Not rs.EOF Then
MsgBox "هنا طبعا دالة بحث يستطيع ايضا يبحث برقم جوال الشخص وهذه رساله اذا الرقم غي موجود", vbInformation
Text1(4).SetFocus
Exit Sub
End If
cn.Close
With Adodc1.Recordset
.AddNew
هنا طريقة الاضافه في القاعده
!sta_id = Text1(0)
!sta_name = Text1(1)
!qualified = Text1(2)
!id_source = Combo1
!nationality = Combo2
!university = Text1(3)
!dep_name = Combo3
!job = Combo4
!specialization = Text1(4)
' Dim Sor As String
' Open OpenFile For Binary As 1
' Sor = String(LOF(1), vbNullChar)
' Get 1, , Sor
' ![Fld_Picture] = Sor
' Close 1
'
' .Update
'(هذا الامر يضيف الصوره في قاعده) !baderww = Img_Picture
!dep_id = Text1(5)
!address = Text1(6)
!tel1 = Text1(7)
!tel2 = Text1(8)
!fater = Text1(9)
!link = Text1(10)
!stc = Text1(11)
!tel3 = Text1(12)
!fah = Combo5
'------------------------------------------------------
!s1 = Text6(0)
!s2 = Text6(1)
!s3 = Text6(2)
!s4 = Text6(3)
!s5 = Text6(4)
!s6 = Text6(5)
!s7 = Text6(6)
!s8 = Text6(7)
!s9 = Text6(8)
!s10 = Text6(9)
!m1 = Text7(0)
!m2 = Text7(1)
!m3 = Text7(2)
!m4 = Text7(3)
!m5 = Text7(4)
!m6 = Text7(5)
!m7 = Text7(6)
!m8 = Text7(7)
!m9 = Text7(8)
!m10 = Text7(9)
'-------------------------------------------
!f1 = Text8(0)
!f2 = Text8(1)
!f3 = Text8(2)
!f4 = Text8(3)
!f5 = Text8(4)
!f6 = Text8(5)
!f7 = Text8(6)
!f8 = Text8(7)
!f9 = Text8(8)
!f10 = Text8(9)
'--------------------------------------
!b1 = Text9(0)
!b2 = Text9(1)
!b3 = Text9(2)
!b4 = Text9(3)
!b5 = Text9(4)
!b6 = Text9(5)
!b7 = Text9(6)
!b8 = Text9(7)
!b9 = Text9(8)
!b10 = Text9(9)
!slok = Text10(0)
!moth = Text10(1)
!gd = Text10(2)
!zzz = Text10(3)
!ccc = Text10(4)
!nnn = Text10(5)
!hhh = Text10(6)
!iii = Text10(7)
!pppp = Text10(8)
!vvv = Combo6
!ggg = Combo7
!catubh = Combo8
!sruh = Combo9
!fasual = Combo10
!dorah = Combo11
MsgBox "ÊãÊ ÇáÅÖÇÝÉ ÈäÌÇÍ", vbInformation
Command2.Visible = False
Command3.Visible = False
.Update
.Requery
End With
Adodc1.Refresh
Text1(0) = ""
Text1(1) = ""
Text1(2) = ""
Combo1 = ""
Text1(3) = ""
Combo2 = ""
Text1(5) = ""
Text1(4) = ""
Combo4 = ""
Combo5 = ""
Text1(6) = ""
Combo3 = ""
Text1(7) = ""
Text1(8) = ""
Text1(10) = ""
Text1(11) = ""
Text1(9) = ""
Text1(12) = ""
Text6(0) = ""
Text6(1) = ""
Text6(2) = ""
Text6(3) = ""
Text6(4) = ""
Text6(5) = ""
Text6(6) = ""
Text6(7) = ""
Text6(8) = ""
Text6(9) = ""
Text7(0) = ""
Text7(1) = ""
Text7(2) = ""
Text7(3) = ""
Text7(4) = ""
Text7(5) = ""
Text7(6) = ""
Text7(7) = ""
Text7(8) = ""
Text7(9) = ""
'-------------------------------------------
Text8(0) = ""
Text8(1) = ""
Text8(2) = ""
Text8(3) = ""
Text8(4) = ""
Text8(5) = ""
Text8(6) = ""
Text8(7) = ""
Text8(8) = ""
Text8(9) = ""
'--------------------------------------
Text9(0) = ""
Text9(1) = ""
Text9(2) = ""
Text9(3) = ""
Text9(4) = ""
Text9(5) = ""
Text9(6) = ""
Text9(7) = ""
Text9(8) = ""
Text9(9) = ""
Text10(0) = ""
Text10(1) = ""
Text10(2) = ""
Text10(3) = ""
Text10(4) = ""
Text10(5) = ""
Text10(6) = ""
Text10(7) = ""
Combo6 = ""
Combo7 = ""
Combo8 = ""
Text10(8) = ""
Combo9 = ""
Combo10 = ""
Combo11 = ""
Call stafflist
'Adodc1.Refresh
Command1(0).Visible = True
Command1(1).Visible = True
Command1(2).Visible = True
Command1(3).Visible = True
Command1(4).Visible = True
Command1(5).Visible = True
Command1(6).Visible = False
Command1(7).Visible = False
End Subاذا زر الامر اضافة مافيه مشكله
المشكله في زر البحث وهذا الكود حقه
Private Sub datashow()
On Error Resume Next
cn.Open
Set rs = cn.Execute("select * from medical_staff where qualified=" & Text1(2) & "")
Set rs = cn.Execute("select * from medical_staff where specialization=" & Text1(4) & "")
If rs.EOF Then
MsgBox "هذا الرقم غير مسجل سابقا ", vbInformation
Text1(2).Text = ""
Text1(2).SetFocus
Else
Text1(0) = rs.Fields("sta_id")
Text1(1) = rs.Fields("sta_name")
Text1(2) = rs.Fields("qualified")
Combo1 = rs.Fields("id_source")
Combo2 = rs.Fields("nationality")
Text1(3) = rs.Fields("university")
Combo3 = rs.Fields("dep_name")
Combo4 = rs.Fields("job")
Text1(4) = rs.Fields("specialization")
Text1(5) = rs.Fields("dep_id")
Text1(6) = rs.Fields("address")
Text1(7) = rs.Fields("tel1")
Text1(8) = rs.Fields("tel2")
Text1(9) = rs.Fields("fater")
Text1(10) = rs.Fields("link")
Text1(11) = rs.Fields("stc")
Text1(12) = rs.Fields("tel3")
Combo5 = rs.Fields("fah")
'-----------------------------------------------------------(لاحظ هنا انا وش مسوي طريقه عقيمه هنا تحت وهي بديت اشرط اذا رقم الشخص مثل كذا 42323 اظهرلي صورته )
الطريقه قمت واضفت صور الاشخاص عندي وحددت صورهم بارقامه واكيد طبع اذا اضفت الرقم المحدد راح يظهر صورته طيب راح ينفذ البرنامج تمام اذا الاشخاص محددين طيب لنفرض عطيت البرنامج شخص اخر وعنده اسماء وارقم بطايث وصور جديده
اذا لن ينفذ البرنامج صح راح يكون مكان الصوره فارغ لاني كاتب الشرط في الكود والشخص الاخر يتعامل مع البرنامج بعد ماعملنا له
ست اب اذا الطريق عقيمه هذه ومحدده واعتقد افضل حل هي الطريقه I
تخزين الصوره ف ي القاعده واسترجاعها بستخدم الاده
(CommonDialog1)
____________________________________________________
f Text1(2) = "4260071" Then
Image3.Visible = True
Else
If Text1(2) = "4260051" Then
Image2.Visible = True
Else
If Text1(2) = "4260003" Then
Image4.Visible = True
Else
If Text1(2) = "4260007" Then
Image5.Visible = True
Else
If Text1(2) = "4260043" Then
Image6.Visible = True
Else
If Text1(2) = "4260095" Then
Image7.Visible = True
Else
If Text1(2) = "4261022" Then
Image8.Visible = True
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
'--------------------------------
Text6(0) = rs.Fields("s1")
Text6(1) = rs.Fields("s2")
Text6(2) = rs.Fields("s3")
Text6(3) = rs.Fields("s4")
Text6(4) = rs.Fields("s5")
Text6(5) = rs.Fields("s6")
Text6(6) = rs.Fields("s7")
Text6(7) = rs.Fields("s8")
Text6(8) = rs.Fields("s9")
Text6(9) = rs.Fields("s10")
'____________________________________
Text7(0) = rs.Fields("m1")
Text7(1) = rs.Fields("m2")
Text7(2) = rs.Fields("m3")
Text7(3) = rs.Fields("m4")
Text7(4) = rs.Fields("m5")
Text7(5) = rs.Fields("m6")
Text7(6) = rs.Fields("m7")
Text7(7) = rs.Fields("m8")
Text7(8) = rs.Fields("m9")
Text7(9) = rs.Fields("m10")
'------------------------------------
Text8(0) = rs.Fields("f1")
Text8(1) = rs.Fields("f2")
Text8(2) = rs.Fields("f3")
Text8(3) = rs.Fields("f4")
Text8(4) = rs.Fields("f5")
Text8(5) = rs.Fields("f6")
Text8(6) = rs.Fields("f7")
Text8(7) = rs.Fields("f8")
Text8(8) = rs.Fields("f9")
Text8(9) = rs.Fields("f10")
'_____________________________________
Text9(0) = rs.Fields("b1")
Text9(1) = rs.Fields("b2")
Text9(2) = rs.Fields("b3")
Text9(3) = rs.Fields("b4")
Text9(4) = rs.Fields("b5")
Text9(5) = rs.Fields("b6")
Text9(6) = rs.Fields("b7")
Text9(7) = rs.Fields("b8")
Text9(8) = rs.Fields("b9")
Text9(9) = rs.Fields("b10")
Text10(0) = rs.Fields("slok")
Text10(1) = rs.Fields("moth")
Text10(2) = rs.Fields("gd")
Text10(3) = rs.Fields("zzz")
Text10(4) = rs.Fields("ccc")
Text10(5) = rs.Fields("nnn")
Text10(6) = rs.Fields("hhh")
Text10(7) = rs.Fields("iii")
Text10(8) = rs.Fields("pppp")
Combo6 = rs.Fields("vvv")
Combo7 = rs.Fields("ggg")
Combo8 = rs.Fields("catubh")
Combo9 = rs.Fields("sruh")
Combo10 = rs.Fields("fasual")
Combo11 = rs.Fields("dorah")
(وهذا الامر لاظهر الصوره من القعده بس ماينفذ للاسف مدري ايش الخطاء) (" Img_Picture = rs.Fields("baderww")
MsgBox "تم البحث بنجاح", vbInformation
cn.Close
Command1(0).Visible = False
Command1(1).Visible = False
Command1(2).Visible = True
Command1(3).Visible = True
Command1(4).Visible = True
Command1(5).Visible = False
Command1(6).Visible = True
Command1(7).Visible = True
End Subاتمنى من الجميع فهم الكود والمطلوب ويساعدني تكففون
بتظاركم على المنتدى
والاميل ABUNOWAF@HOTMAIL.COM
لو يريد احد اي معلومات ايضاحيه يبلغني على اي وسيله