تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] اين الخطأ هنا ..
#2
Public Sub MoveToDOne()

con = New SqlConnection(cs)
Dim CmdInsert As New SqlCommand
Dim RowsAffected As Integer = 0
If con.State = 1 Then con.Close()
con.Open()

'################################################################
For i As Integer = 0 To DataGridView2.Rows.Count - 1
cmd = New SqlCommand
With cmd
.Connection = con
.CommandType = CommandType.Text
.CommandText = "Insert Into DeviceDone(device_code,cus_name,device_name,cus_phone,cus_address,Brand,model,Place_reform,serial_device,problem,Customer_Complaint,Maximum_cost,received_date,delivery_date)values(@device_code,@cus_name,@device_name,@cus_phone,@cus_address,@Brand,@model,@Place_reform,@serial_device,@problem,@Customer_Complaint,@Maximum_cost,@received_date,@delivery_date)"
.Parameters.Clear()
.Parameters.AddWithValue("@device_code", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(0).Value
.Parameters.AddWithValue("@cus_name", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(1).Value
.Parameters.AddWithValue("@device_name", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@cus_phone", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(2).Value
.Parameters.AddWithValue("@cus_address", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@Brand", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@model", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@Place_reform", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@serial_device", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@problem", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(3).Value
.Parameters.AddWithValue("@Customer_Complaint", SqlDbType.VarChar).Value = 0
.Parameters.AddWithValue("@Maximum_cost", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(4).Value
.Parameters.AddWithValue("@received_date", SqlDbType.Date).Value = DataGridView2.Rows(i).Cells(5).Value
.Parameters.AddWithValue("@delivery_date", SqlDbType.Date).Value = DataGridView2.Rows(i).Cells(6).Value
'.Parameters.AddWithValue("@device_code", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(0).Value
'.Parameters.AddWithValue("@cus_name", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(1).Value
'.Parameters.AddWithValue("@cus_phone", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(2).Value
'.Parameters.AddWithValue("@problem", SqlDbType.VarChar).Value = DataGridView2.Rows(i).Cells(3).Value
'.Parameters.AddWithValue("@Maximum_cost", SqlDbType.Date).Value = DataGridView2.Rows(i).Cells(4).Value
'.Parameters.AddWithValue("@received_date", SqlDbType.Date).Value = DataGridView2.Rows(i).Cells(5).Value
'.Parameters.AddWithValue("@delivery_date", SqlDbType.Date).Value = DataGridView2.Rows(i).Cells(6).Value
End With
Next
MsgBox(" عفواً ، هناك خطأ بعملية الحفظ", MessageBoxIcon.Exclamation)

'MessageBox.Show(" عفواً ، هناك خطأ بعملية الحفظ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)
Exit Sub
'################################################################
con.Close()
End Sub
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
اين الخطأ هنا .. - بواسطة h2551996 - 12-01-25, 10:54 PM
RE: اين الخطأ هنا .. - بواسطة h2551996 - 13-01-25, 11:01 AM
RE: اين الخطأ هنا .. - بواسطة h2551996 - 14-01-25, 07:51 PM
RE: اين الخطأ هنا .. - بواسطة aljzazy - 14-01-25, 11:48 PM
RE: اين الخطأ هنا .. - بواسطة h2551996 - 16-01-25, 08:46 PM
RE: اين الخطأ هنا .. - بواسطة h2551996 - 18-01-25, 08:59 PM


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


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