29-11-12, 04:28 PM
السلام عليكم ورحمة الله وبركاته,,,
السطرهذا لا يعمل بشكل صحيح RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
وهذا الكود كامل
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Command2_Click()
If Text1 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇáÇÓã", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text2 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇÓã ÇáÇÈ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text3 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇÓã ÇáÌÏ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text4 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇááÞÈ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text5 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÑÞã ÇáãæÙÝ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text6 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇáæÙíÝÉ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
SQLs = "select * from emp where empno='" & Text5 & "'"
If RS.State = adStateOpen Then RS.Close
RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
If RS.EOF Then
GoTo okaddnew:
Else
MsgBox "ÚÝæÇ ÑÞã ÇáãæÙÝ ãæÌæÏ ãÓÈÞÇ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
okaddnew:
RS.AddNew
If Not Text1 = "" Then RS![firstname] = Text1
If Not Text2 = "" Then RS![fathername] = Text2
If Not Text3 = "" Then RS![grandname] = Text3
If Not Text4 = "" Then RS![famliyname] = Text4
If Not Text5 = "" Then RS![empno] = Text5
If Not Text6 = "" Then RS![job] = Text6
RS.Update
MsgBox "The information has been saved", vbInformation + vbMsgBoxRight, "Save"
End Sub
Private Sub Form_Load()
poolconnection
SQLs = "select * from emp"
If RS.State = adStateOpen Then RS.Close
RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
End Sub
السطرهذا لا يعمل بشكل صحيح RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
وهذا الكود كامل
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Command2_Click()
If Text1 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇáÇÓã", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text2 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇÓã ÇáÇÈ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text3 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇÓã ÇáÌÏ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text4 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇááÞÈ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text5 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÑÞã ÇáãæÙÝ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
If Text6 = "" Then
MsgBox "ÚÝæÇ íÌÈ ßÊÇÈÉ ÇáæÙíÝÉ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
SQLs = "select * from emp where empno='" & Text5 & "'"
If RS.State = adStateOpen Then RS.Close
RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
If RS.EOF Then
GoTo okaddnew:
Else
MsgBox "ÚÝæÇ ÑÞã ÇáãæÙÝ ãæÌæÏ ãÓÈÞÇ", vbCritical + vbMsgBoxRight, "ÎØÃ"
Exit Sub
End If
okaddnew:
RS.AddNew
If Not Text1 = "" Then RS![firstname] = Text1
If Not Text2 = "" Then RS![fathername] = Text2
If Not Text3 = "" Then RS![grandname] = Text3
If Not Text4 = "" Then RS![famliyname] = Text4
If Not Text5 = "" Then RS![empno] = Text5
If Not Text6 = "" Then RS![job] = Text6
RS.Update
MsgBox "The information has been saved", vbInformation + vbMsgBoxRight, "Save"
End Sub
Private Sub Form_Load()
poolconnection
SQLs = "select * from emp"
If RS.State = adStateOpen Then RS.Close
RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
End Sub