Hi Experts,
I got 2 textboxes, 1 for old notes (from database), 1 for new notes (entered by user). When user click 'Save Note', new notes will be appended to top of old notes and write into database and then display as old notes. My problem is the resulting notes won't display in the old notes text box. I have to refresh the page to see it. What do I need to do to make it display without refreshing the page?
Appreciate so much for any response.
here are my code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
SqlDataAdapter1.SelectCommand.Parameters("@Ticket").Value = CInt(Request.QueryString("Ticket"))
SqlDataAdapter1.Fill(DsStatusMemo1)
strStatusMemo = DsStatusMemo1.Tables(0).Rows(0).Item("StatusMemo")
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim myCommand As SqlCommand
Try
myCommand = New SqlCommand
myCommand.Connection = SqlConnection1
myCommand.CommandText = "ServiceOrders_StatusMemo_Update_Sp"
myCommand.CommandType = CommandType.StoredProcedure
Dim myParameter1 As New SqlParameter("@Ticket", SqlDbType.Int)
myParameter1.Direction = ParameterDirection.Input
myParameter1.Value = CInt(Request.QueryString("Ticket"))
Dim myParameter2 As New SqlParameter("@StatusMemo", SqlDbType.VarChar)
myParameter2.Direction = ParameterDirection.Input
myParameter2.Value = CStr(Now()) & vbCrLf & txtNewNotes.text & vbCrLf & vbCrLf & txtOldNotes.text
myCommand.Parameters.Add(myParameter1)
myCommand.Parameters.Add(myParameter2)
SqlConnection1.Open()
myCommand.ExecuteNonQuery()
Catch er As Exception
'handle the error
Finally
SqlConnection1.Close()
End Try
End Sub
I got 2 textboxes, 1 for old notes (from database), 1 for new notes (entered by user). When user click 'Save Note', new notes will be appended to top of old notes and write into database and then display as old notes. My problem is the resulting notes won't display in the old notes text box. I have to refresh the page to see it. What do I need to do to make it display without refreshing the page?
Appreciate so much for any response.
here are my code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
SqlDataAdapter1.SelectCommand.Parameters("@Ticket").Value = CInt(Request.QueryString("Ticket"))
SqlDataAdapter1.Fill(DsStatusMemo1)
strStatusMemo = DsStatusMemo1.Tables(0).Rows(0).Item("StatusMemo")
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim myCommand As SqlCommand
Try
myCommand = New SqlCommand
myCommand.Connection = SqlConnection1
myCommand.CommandText = "ServiceOrders_StatusMemo_Update_Sp"
myCommand.CommandType = CommandType.StoredProcedure
Dim myParameter1 As New SqlParameter("@Ticket", SqlDbType.Int)
myParameter1.Direction = ParameterDirection.Input
myParameter1.Value = CInt(Request.QueryString("Ticket"))
Dim myParameter2 As New SqlParameter("@StatusMemo", SqlDbType.VarChar)
myParameter2.Direction = ParameterDirection.Input
myParameter2.Value = CStr(Now()) & vbCrLf & txtNewNotes.text & vbCrLf & vbCrLf & txtOldNotes.text
myCommand.Parameters.Add(myParameter1)
myCommand.Parameters.Add(myParameter2)
SqlConnection1.Open()
myCommand.ExecuteNonQuery()
Catch er As Exception
'handle the error
Finally
SqlConnection1.Close()
End Try
End Sub