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

نسخة كاملة : رسالة لم تتم تهيئة خاصية ExecuteNonQuery
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم

يا شباب كيف اهئ خاصية ExecuteNonQuery 
كود :
Protected Sub SinUpU()
       Dim cmd As New SqlCommand
       Try

           Dim conn As New SqlConnection()
         
           conn.ConnectionString = "Data Source=a-pc\sqlexpress;Initial Catalog=DataKaleej;Integrated Security=True"

           conn.Open()


           cmd.CommandText = "update DataStudents$ set Password='" & TPass1.Text & "' where ID='" & " where ID='" + Tuser.Text + "'"
           cmd.ExecuteNonQuery()


           conn.Close()
         
           Lb3.Text = "تم تغيير كلمة المرور بنجاح"

           Lb3.ForeColor = Drawing.Color.Green




       Catch ex As Exception
         
           MsgBox(ex.Message.ToString)

       End Try
   End Sub
السلام عليكم

لم تربط امر cmd بالاتصال conn ضع الكود التالي قبل conn.Open
جرب التالي
كود :
cmd.Connection=conn
وعليكم السلام
تفضل

PHP كود :
Protected Sub SinUpU()
 
      Dim cmd As New SqlCommand
       
Try

 
          Dim conn As New SqlConnection()
 
         
           conn
.ConnectionString "Data Source=a-pc\sqlexpress;Initial Catalog=DataKaleej;Integrated Security=True"

 
         

        cmd
.Connection conn
        cmd
.CommandType CommandType.Text
           cmd
.CommandText "update DataStudents$ set Password='" TPass1.Text "' where ID='" Tuser.Text "'"
         
  
            conn
.Open()
 
          cmd.ExecuteNonQuery()
 
          conn.Close()
 
         
           Lb3
.Text "تم تغيير كلمة المرور بنجاح"

 
          Lb3.ForeColor Drawing.Color.Green




       
Catch ex As Exception
          
           MsgBox
(ex.Message.ToString)

 
      End Try
 
  End Sub 
جزاكم الله عني كل خير وبارك الله فيكم وفي علمكم