تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] Update sql table
#1
ارجوا المساعدة في تصحيح مشكلة هذا الكود جميع شروط تعمل ولكن المشكلة في update فبعد انهاء جميع الشروط يعطيني مسج بانه تم تغير كلمة المرور ولكن للاسف لا يحدث هذا التغير فما هي المشكلة في الكود ارجوا المساعدة في حله وشرح الخطأ
كود :
Dim da As SqlDataAdapter
       Dim dt As DataTable
       If txt_user.Text = "" Or txt_ppass.Text = "" Then
           MsgBox("Pleaze entre all information", MsgBoxStyle.Information, "Error")
       Else


           Dim sqlconn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\m7md\Documents\Visual Studio 2008\Projects\Cars\Cars\cars.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
           dt = New DataTable
           da = New SqlDataAdapter
           Dim sql As String = ("select * from tbl_register where db_user='" & txt_user.Text & "' and db_pass='" & txt_ppass.Text & "'")
           da = New SqlDataAdapter(sql, sqlconn)
           dt.Clear()
           da.Fill(dt)
           If (dt.Rows.Count = 0) Then
               MsgBox("User name not exist/or password not correct")
           Else
               Label4.Visible = True
               txt_npass.Visible = True
               Label5.Visible = True
               txt_cpass.Visible = True
               If Val(txt_npass.Text) = Val(txt_cpass.Text) Then
                   If txt_npass.TextLength < 8 Then
                       MsgBox("Password must be at least eight characters ", MsgBoxStyle.Exclamation, "")
                       Exit Sub
                   End If
                   Dim all As New List(Of String)
                   For Each t In txt_npass.Text
                       all.Add(t)
                   Next


                   If Char.IsUpper(all.Item(0)) = False Then
                       MsgBox("The first letter must be a Capital")
                       Exit Sub
                   End If



                   Dim upper As Integer = 0
                   Dim lower As Integer = 0
                   Dim symbol As Integer = 0
                   Dim num As Integer = 0

                   Dim str As String = txt_npass.Text  '"Hello$"
                   For [loop] As Integer = 0 To str.Length - 1
                       If [Char].IsUpper(str([loop])) Then
                           upper += 1
                       ElseIf [Char].IsLower(str([loop])) Then
                           lower += 1
                       ElseIf [Char].IsSymbol(str([loop])) Then
                           symbol += 1

                       ElseIf [Char].IsNumber(str([loop])) Then
                           num += 1


                       End If
                   Next


                   MsgBox("Excellent now password is strong ", MsgBoxStyle.Information, "")
                   sqlconn.Open()
                   Dim update As New SqlCommand("Update tbl_register set(db_pass)='" & txt_npass.Text & "' where (db_user='" & txt_user.Text & "' )", sqlconn)
                   sqlconn.Close()
                   MsgBox("Password has been change", MsgBoxStyle.Information, "Error")
               Else
                   MsgBox("Password not compatible")
               End If


           End If


       End If
الرد }}}
تم الشكر بواسطة:
#2
اخي هذا المسار صحيح للملف ؟

C:\Users\m7md\Documents\Visual Studio 2008\Projects\Cars\Cars\cars.mdf
الرد }}}
تم الشكر بواسطة:
#3
السلام عليكم ورحمة الله وبركاته


لق

[size=large][b]السلام عليكم ورحمة الله وبركاته



لق

[size=large][b]السلام عليكم ورحمة الله وبركاته



لق

[size=large][b]السلام عليكم ورحمة الله وبركاته



أولا أنت وضعت إجراءات كثيرة في دالة واحدة، المفروض أن تقوم بتقسيم المهام مثل دالة ExistUser لمعرفة وجود اسم المستخدم ودالة CheckPassword لفحص كلمة المرور.


على العموم..... 
لقد نسيت أن تضع الأمر update.ExecuteNonQuery بعد السطر
كود :
Dim update As New SqlCommand(.....
نصيحة غير طريقتك في كتابة البرمجة.....


السلام عليكم ورحمة الله وبركاته
الرد }}}
تم الشكر بواسطة: احمد تيم
#4
شكرا لكم لقد نجح الامر
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
Photo SQL Update Bashar_123456 4 865 06-11-22, 08:38 PM
آخر رد: Bashar_123456
  [SQL] انا احتاج للنسخ1 table في قاعدة بيانات 1 الى table1 في قاعدة بيانات2 في essamprog2020 1 1,580 19-04-20, 02:13 AM
آخر رد: asemshahen5
  [سؤال] هل من كود لعمل update set لبيانات الجدول من الداتا جريد احمد عبد الحكيم 7 3,883 18-12-15, 06:55 PM
آخر رد: احمد عبد الحكيم
  [VB.NET] وضع متغير فى جملة Update mathmagic 3 3,427 25-10-15, 10:20 AM
آخر رد: mathmagic
  مشكلة في Update benomar 2 2,278 12-10-14, 03:10 PM
آخر رد: benomar
  Update image in MS Access eng.khalidvb 0 1,799 30-08-13, 05:19 PM
آخر رد: eng.khalidvb

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


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