الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكله فى الحفظ

بدأه shosho842000 في 2 ديسمبر 2009 · 1 رد · 466 مشاهدة · في ADO.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مشكلتى هى عدم الحفظ لا يتم الحفظ بعد هذا الكود ولا يظهر اى خطا

بل يتم اظهار رساله تم الحفظ ولكن لا اراى السجل الذى تم تسجيله

الكود كالاتى :

 If cn.State = ConnectionState.Open Then cn.Close()
 	cn.Open()
 	For x As Integer = 0 To DataGridView1.Rows.Count - 1
 	If Not DataGridView1.Rows.Item(x).IsNewRow Then
 	Dim emp_id As Integer = TextBox1.Text
 	Dim name As String = DataGridView1.Rows.Item(x).Cells(1).Value
 	Dim date1 As DateTime = DataGridView1.Rows.Item(x).Cells(3).Value
 	Dim no As Integer = DataGridView1.Rows.Item(x).Cells(4).Value
 	Dim date2 As DateTime = DataGridView1.Rows.Item(x).Cells(5).Value
 	Dim kind As String = DataGridView1.Rows.Item(x).Cells(6).Value
 	Dim notes As String = DataGridView1.Rows.Item(x).Cells(8).Value

 	Dim cmd2 As New SqlClient.SqlCommand("SELECT COUNT(*) FROM stop_emp WHERE name=@name", cn)
 	cmd2.Parameters.AddWithValue("@name", name)
 	Dim count As Integer = cmd2.ExecuteScalar()
 	If count > 0 Then
 	Continue For
 	End If

 	cmd.Parameters.Clear()
 	cmd.CommandType = CommandType.StoredProcedure
 	cmd.CommandText = "insertstop_emp"
 	cmd.Parameters.Add("@emp_id", SqlDbType.Int).Value = TextBox1.Text
 	cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = name
 	cmd.Parameters.Add("@date", SqlDbType.DateTime).Value = date1
 	cmd.Parameters.Add("@no", SqlDbType.Int).Value = no
 	cmd.Parameters.Add("@date1", SqlDbType.DateTime).Value = date2
 	cmd.Parameters.Add("@kind", SqlDbType.VarChar).Value = kind
 	cmd.Parameters.Add("@notes", SqlDbType.VarChar).Value = notes

 	cmd.ExecuteNonQuery()
 	End If
 	Next
 	MessageBox.Show("تم الحفظ ")

وشكرا

#2

برجاء وضع مثال لمشكلتك حتي يتم فحصها وايجاد مصدر الخطأ

certifiedj.jpg

 

 

Image Hosted by ImageShack.us

مواضيع مشابهة