السلام عليكم ..
كيف حالكم أحبابي ؟
انا بواجه مشكاكل .. وهبدأ مسيرة عرضها الان .. إن شاء الله ..
هذي او واحدة
بستخدم VB.NET 2005
ونظام الفيجوال ف الربط بداتا بيز أكسس dataset+TA+BS
المشكلة كالتالي ..
أمر حفظ أو Update بيعمل بس في Form1 ومش شغال ف اي فورم تانية ..
Imports System.Data
Imports System.Data.OleDb
Public Class Form5
Dim xxx As Integer
Dim instance_adapter As New OleDbDataAdapter("SELECT * FROM n_backup", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|n_Backup.mdb;User Id=admin;Password=;")
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'N_BackupDataSet.bouns_1' table. You can move, or remove it, as needed.
Me.Bouns_1TableAdapter.Fill(Me.N_BackupDataSet.bouns_1)
GroupBox3.Hide()
GroupBox5.Hide()
GroupBox6.Hide()
DataGridView1.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.Close()
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
On Error GoTo 0
Bouns1BindingSource.MoveFirst()
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
On Error GoTo 0
Bouns1BindingSource.MovePrevious()
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
On Error GoTo 0
Bouns1BindingSource.MoveNext()
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
On Error GoTo 0
Bouns1BindingSource.MoveLast()
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
GroupBox5.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
GroupBox5.Show()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
On Error GoTo -1
'GroupBox2.Show()
TextBox5.ReadOnly = False
Dialog1.Show()
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
On Error GoTo -1
Bouns1BindingSource.CancelEdit()
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
If TextBox13.Text = "" Then
MsgBox("أدخل ماتريد البحث عنه")
Exit Sub
End If
Dim myCommand As New OleDbCommand
If ComboBox1.Text = "إسم الموظف" Then
myCommand.CommandText = "Select * from Bouns_1 where name='" & TextBox13.Text + "'"
End If
If ComboBox1.Text = "كود الموظف" Then
myCommand.CommandText = "Select * from Bouns_1 where Employ_no=" & TextBox13.Text
End If
myCommand.Connection = Bouns_1TableAdapter.Connection
myCommand.Connection.Open()
'yourDataSet.Employ.Row.Clear()
Me.N_BackupDataSet.bouns_1.Rows.Clear()
Me.N_BackupDataSet.bouns_1.Load(myCommand.ExecuteReader)
myCommand.Connection.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox(" من فضلك أكمل البيانات المتبقية")
Else
Me.Bouns_1TableAdapter.Update(N_BackupDataSet.bouns_1)
End If
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
DataGridView1.Show()
GroupBox1.Hide()
GroupBox4.Hide()
GroupBox6.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error GoTo 0
Bouns1BindingSource.MoveFirst()
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
On Error GoTo 0
Bouns1BindingSource.MovePrevious()
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
On Error GoTo 0
Bouns1BindingSource.MoveNext()
End Sub
Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
On Error GoTo 0
Bouns1BindingSource.MoveLast()
End Sub
Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
DataGridView1.Hide()
GroupBox1.Show()
GroupBox4.Show()
GroupBox6.Hide()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If MsgBox("هل أنت متأكد ؟", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Bouns1BindingSource.RemoveCurrent()
'Bouns_1TableAdapter.Update(N_BackupDataSet.Bouns_1)
End If
End Sub
Private Sub TextBox5_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.Leave
' Me.Bouns_1TableAdapter.Fill(N_BackupDataSet.bouns_1)
'Me.Bouns_1TableAdapter.u.update(N_BackupDataSet.bouns_1)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
xxx = Dialog1.TextBox1.Text
TextBox5.Text = xxx
End Sub
End Classانا بحثت بالمنتدى كله حاط اوامر ال OLDB انا لو استخدمتها هتأخر عن الموعد .. وحتى عند الحفظ في الفورم 1
بيضيع البينات الي ادخلتها مع اغلاق الفورم او البرنامج
بس المضطر بيركب الصعب .. وحاولت احط االاتنين ف الكود يعني اوصلهم فيجواليا والاوامر احطها مو مشكلة ..
جزاكم الله خير . .