12-01-25, 10:54 PM
السلام عليكم
ما الحل يا اخوان
https://top4top.io/downloadf-3299ste8m1-rar.html
ما الحل يا اخوان
https://top4top.io/downloadf-3299ste8m1-rar.html
كود :
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