منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : ارجو المساعدة في هذا الكود ضروري
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
PHP كود :
[align=left][align=left]
Option Explicit
Dim AConnection 
As New ADODB.Connection
Dim ARecordset 
As New ADODB.Recordset
Private Sub cmdAdd_Click()
On Error Resume Next
If txtTitle1.Text "" Then
MsgBox 
" ب7 ا @; ا Z. أد <¤M"vbOKOnly" ت77A ل ا 7. إد M dF. "
Exit Sub
Else:
If 
txtFirstName1.Text "" Then
MsgBox 
" ب7 ع ا  Z. أد <¤M"vbOKOnly" ت77A ل ا 7. إد M dF. "
Exit Sub
Else:
If 
txtSurname1.Text "" Then
MsgBox 
" ب7 ا w.I @; ا Z. أد <¤M"vbOKOnly" ت77A ل ا 7. إد M dF. "
Exit Sub
Else:
If 
txtPhone1.Text "" Then
MsgBox 
" ب7 ا w« و Z. أد <¤M"vbOKOnly" ت77A ل ا 7. إد M dF. "
Exit Sub
End 
If
End If
End If
End If
ARecordset.AddNew
ARecordset
.Fields("Title") = txtTitle1.Text " "
ARecordset.Fields("First Name") = txtFirstName1.Text " "
ARecordset.Fields("Surname") = txtSurname1.Text " "
ARecordset.Fields("Phone Number") = txtPhone1.Text " "
txtTitle1.Text ""
txtFirstName1.Text ""
txtSurname1.Text ""
txtPhone1.Text ""
ARecordset.MoveLast
GetFields
End Sub
Private Sub cmdDelete_Click()
On Error Resume Next
ARecordset
.Delete adAffectCurrent
ARecordset
.MoveFirst
GetFields
End Sub
Private Sub cmdFirst_Click()
On Error Resume Next
ARecordset
.MoveFirst
GetFields
End Sub
Private Sub cmdLast_Click()
On Error Resume Next
ARecordset
.MoveLast
GetFields
End Sub
Private Sub cmdNext_Click()
On Error Resume Next
ARecordset
.MoveNext
GetFields
End Sub
Private Sub cmdPrevious_Click()
On Error Resume Next
ARecordset
.MovePrevious
GetFields
End Sub
Private Sub Form_Load()
On Error GoTo ErrorHandler
AConnection
.ConnectionString "provider=Microsoft.Jet.OLEDB.4.0;data"
source=Database.mdb;"
AConnection.CursorLocation = adUseClient
AConnection.Open
ARecordset.Open "
Select from Customers", AConnection, adOpenDynamic, adLockOptimistic
If AConnection.State = 1 Then
GetFields
End If
Exit Sub
ErrorHandler:
MsgBox Err.Number & vbCrLf & vbCrLf & Err.Description & vbCrLf & vbCrLf & " 
نا s*D+z i   ا", vbOKOnly, "Error!"
End
End Sub
Private Sub Form_Unload(Cancel As Integer)
AConnection.Close
Set AConnection = Nothing
End Sub
Private Sub GetFields()
txtID.Text = ARecordset(0)
txtTitle.Text = ARecordset(1)
txtFirstName.Text = ARecordset(2)
txtSurname.Text = ARecordset(3)
txtPhone.Text = ARecordset(4)
End Sub[/align][/align]

الخطا في هذا السطر 
[align=left]
AConnection.ConnectionString = "
provider=Microsoft.Jet.OLEDB.4.0;data"
source=Database.mdb;"
[/align
[/quote]
تاكد من الاتصال بالقاعده
هذا السطر هو نص الاتصال بقاعدة البيانات

كود :
AConnection.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;datٍaSource=Database.mdb;"

حيث Database هو اسم قاعدة البيانات .....

تأكد من هذه الاشياء ... وتأكد من الفواصل وحالة الأحرف ......