تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مساعدة فى تحديث قاعدة بيانات بكبسة واحدة
#5
الحمد لله الذى بنعمته تتم الصالحات


لقد تم الحل ولله الحمد أولاً وأخيراً ومن ثم الشكر لأخى المهندس eng_ashraf (من منتديات الفريق العربي للبرمجة) الذى أوحى بفكرة الحل فجزاءه الله خير الجزاء وكذلك الشكر أجزله للأخ الفاضل سعود الذى حاول المساعدة وأدلى بفكرته . لذلك أضع الكود الذى توصلت إليه بحمد الله وتوفيقه لكى يستفيد من الفكرة الجميع وأرجو من الجميع شاكراً لو أى حد عنده ملاحظة أو إضافة أو تصويب لخطأ ما أن لا يبخل به علينا وجزاكم الله خيرا

كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'On Error Resume Next

        If TextBox28.Text = "" Or TextBox28.Text = "0" Then
            MsgBox("You can't Update with Nul value", vbCritical, "Error")
            Exit Sub
            TextBox28.Select()
        End If
        Dim bsc As Double = Val(TextBox28.Text / 100)

        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If
        Dim oleDBC As New OleDbCommand
        Dim oleDBDR As OleDbDataReader
        Dim c As Integer
        c = 0
        With oleDBC
            .Connection = conn
            .CommandText = "select * from EMP where DEPT<>'" & Trim("Management") & "'and c_cont= False"
        End With
        oleDBDR = oleDBC.ExecuteReader

        If oleDBDR.HasRows Then
            While oleDBDR.Read
                DataSet1.Tables("EMP").Rows(c).BeginEdit()
                DataSet1.Tables("EMP").Rows(c).Item("BASIC") = Math.Round((Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * bsc) + DataSet1.Tables("EMP").Rows(c).Item("BASIC")), 0)
                If (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "12") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.41), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "11") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.38), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "10") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.35), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "9") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.32), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "8") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.29), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "7") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.26), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "6") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.23), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "5") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.2), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "4") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.17), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "3") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.16), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "3") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.44), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "4") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.41), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "5") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.38), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "6") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.35), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "7") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "22") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.32), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "8") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.29), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "9") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.27), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "10") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "22") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.25), 0)
                ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "11") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
                    DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.25), 0)
                End If
                DataSet1.Tables("EMP").Rows(c).EndEdit()
                Validate()
                DataAdapter.Update(DataSet1.Tables("EMP"))
                DataSet1.AcceptChanges()
                c = c + 1
            End While
        End If
        conn.Close()
        MessageBox.Show("updated Successfully", "Modify", MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub[/align]
[align=left]
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: مساعدة فى تحديث قاعدة بيانات بكبسة واحدة - بواسطة hsab - 02-02-14, 10:43 PM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  تصدير بيانات من سيكوال bassant 1 236 29-09-25, 01:11 AM
آخر رد: justforit
Heart استرجاع قاعدة بيانات محمد بن عطية 1 1,069 18-07-25, 04:30 AM
آخر رد: abuabdulrhman
  [C#.NET] مشكلة في مجلد قاعدة البيانات kamel1978 3 686 06-10-24, 06:26 PM
آخر رد: Taha Okla
  [سؤال] سؤال حول منع تكرار بيانات عند تعديلها justforit 1 570 07-05-24, 12:09 AM
آخر رد: justforit
  استعلام من عدة جداول لقاعدة بيانات اكسس Adel27213 1 1,261 07-11-23, 08:27 AM
آخر رد: justforit
  [سؤال] عدم إظهار الصور مع النص فى Listview من قاعدة البيانات alims 2 2,034 27-08-23, 12:22 PM
آخر رد: رضوان الجماعي
  أريد مساعدة من فضلكم في زر الإضافة waidom 2 1,954 10-06-23, 12:53 PM
آخر رد: mahmoud mostafa 2023
  [SQL] استفسار عن طريقة تحزم قواعد بيانات MSSQL مع البرنامج VB.NET2019 salemq 2 867 18-05-23, 03:02 AM
آخر رد: سعود
  ما معني بيانات تقع بين الرمز[] في حقل في داتا بيس bassant 3 1,053 03-04-23, 11:53 PM
آخر رد: sanyor77
  تلوين خلية واحدة فقط فى الداتا غريد اذا تغيرت القيمة ؟ a.amin 11 7,820 15-02-23, 02:13 PM
آخر رد: tighrmte

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم