تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مشكلة في الحفظ في الاكسس
#14
ايه الخطأ الي هنا الكود عبارة عن تعديل حقل واحد في الجدول

كود :
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

       If TextBox1.Text = "" Then
           MsgBox("Client Name is Empty", MsgBoxStyle.OkOnly, Title:="warning")
           Return
       Else

           'Try

           If conn9.State = ConnectionState.Closed Then

                   conn9.Open()

               End If
               Dim cmd9 As New OleDbCommand

               Dim pos As Integer = DataGridView1.CurrentRow.Index
               Dim posNm = DataGridView1.Rows(pos).Cells("Cient_Name").Value

               If MsgBox("Are you sure you want update " & posNm, MsgBoxStyle.Question + vbYesNo, Title:="Warning") = vbYes Then


Dim sql As String = "UPDATE mmm SET Feedback = '" & TextBox6.Text & "', WHERE Cient_Name =" & posNm
           
   cmd9.CommandText = sql
                   cmd9.Connection = conn9
                   cmd9.ExecuteNonQuery()

               End If
           'Catch ex As Exception
           'MsgBox("فشل في تعديل البيانات")
           'Finally
           conn9.Close()
           'End Try
           MsgBox("تم التعديل بنجاح")

       End If
   End Sub


كود البوزشن

كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


       Dim currentrw As Integer
       currentrw = DataGridView1.CurrentRow.Index
       Dim posNm = DataGridView1.Rows(currentrw).Cells("Cient_Name").Value
       If MsgBox("Are you sure you want update " & posNm, MsgBoxStyle.Question + vbYesNo, Title:="Warning") = vbYes Then
           TextBox1.Text = DataGridView1.Item(0, currentrw).Value.ToString
           TextBox2.Text = DataGridView1.Item(1, currentrw).Value.ToString
           TextBox3.Text = DataGridView1.Item(2, currentrw).Value.ToString
           TextBox4.Text = DataGridView1.Item(3, currentrw).Value.ToString
           TextBox5.Text = DataGridView1.Item(4, currentrw).Value.ToString
           TextBox6.Text = DataGridView1.Item(5, currentrw).Value.ToString


       End If

   End Sub

المحاولة هذه تمام بس عدلتلي الكل الصفوف مش صف واحد

كود :
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

       If TextBox1.Text = "" Then
           MsgBox("Client Name is Empty", MsgBoxStyle.OkOnly, Title:="warning")
           Return
       Else

           'Try

           If conn9.State = ConnectionState.Closed Then

                   conn9.Open()

               End If
               Dim cmd9 As New OleDbCommand

               Dim pos As Integer = DataGridView1.CurrentRow.Index
               Dim posNm = DataGridView1.Rows(pos).Cells("Cient_Name").Value

               If MsgBox("Are you sure you want update " & posNm, MsgBoxStyle.Question + vbYesNo, Title:="Warning") = vbYes Then



               Dim sql As String = "UPDATE mmm SET Feedback = '" & TextBox6.Text & "'"


               cmd9.CommandText = sql
                   cmd9.Connection = conn9
               'conn9.Open()
               cmd9.ExecuteNonQuery()

               End If
           'Catch ex As Exception
           'MsgBox("فشل في تعديل البيانات")
           'Finally
           conn9.Close()
           'End Try
           MsgBox("تم التعديل بنجاح")

       End If
   End Sub
الرد }}}
تم الشكر بواسطة: asemshahen5


الردود في هذا الموضوع
مشكلة في الحفظ في الاكسس - بواسطة SaedAmer - 26-08-19, 03:15 PM
RE: مشكلة في الحفظ في الاكسس - بواسطة SaedAmer - 30-08-19, 05:37 PM


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


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