M
muhammadanzar
Guest
hi,
some time make bill in previous dates, i make a program when update it take the datetimepicker.value. but when it complete the update task it show previous date. i want when update query executed after that datetimepicker.value go back to current system date and time.
see my code
Private Sub Update_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update_btn.Click
Using connection As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True")
Using command As New SqlCommand("UPDATE [Northwind].[dbo].[Orders] SET [OrderDate] =@OrderDate where OrderID=" & TextBox28.Text, connection)
command.Parameters.AddWithValue("@OrderDate", DateTimePicker1.Value) ' TextBox23.Text) '..TextBox2.Text)
Try
connection.Open()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Data Update in Database", "Order Table Issue", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)
Else
MessageBox.Show("Data not Update in Database")
End If
connection.Close()
Catch ex As Exception
MessageBox.Show("Data not Update in Database")
Exit Sub
Finally
End Try
End Using
End Using
If TextBox2.Text <> "" Then
UpdateInOrderTable()
End If
' showcustomerid()
End Sub
MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959
Continue reading...
some time make bill in previous dates, i make a program when update it take the datetimepicker.value. but when it complete the update task it show previous date. i want when update query executed after that datetimepicker.value go back to current system date and time.
see my code
Private Sub Update_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update_btn.Click
Using connection As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True")
Using command As New SqlCommand("UPDATE [Northwind].[dbo].[Orders] SET [OrderDate] =@OrderDate where OrderID=" & TextBox28.Text, connection)
command.Parameters.AddWithValue("@OrderDate", DateTimePicker1.Value) ' TextBox23.Text) '..TextBox2.Text)
Try
connection.Open()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Data Update in Database", "Order Table Issue", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)
Else
MessageBox.Show("Data not Update in Database")
End If
connection.Close()
Catch ex As Exception
MessageBox.Show("Data not Update in Database")
Exit Sub
Finally
End Try
End Using
End Using
If TextBox2.Text <> "" Then
UpdateInOrderTable()
End If
' showcustomerid()
End Sub
MUHAMMAD ANZAR E-mail : muhammadanzar@hotmail.com Mobile # :0092-3215096959
Continue reading...