Hi Folks,
I've never come across this before:
I have a series of text boxes. The text of these boxes get set on page load. then I have a submit button that calls a sub to update the table with the new values (text) in the text box. The problem is it is keeping the original text not the text that is CURRENTLY in the textbox. Anyone come across this before? Or know how to get round it?
Here is the code from my submit button event:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click
Dim Emails As Integer = txtEmails.Text
Dim Calls As Integer = txtCalls.Text
Dim Contacts As Integer = txtContacts.Text
Dim Tasks As Integer = txtTasks.Text
Dim Meetings As Integer = txtMeetings.Text
Dim Proposals As Integer = txtProposals.Text
Dim Points As Integer = txtPoint.Text
Dim dt As New DataTable()
Try
connection.Open()
Dim sqlCmd As New SqlCommand("UPDATE tblActivityParameters SET Emails = " & Emails & ", Calls = " & Calls & ", Contacts=" & Contacts & ", Tasks =" & Tasks & ", Meetings=" & Meetings & ", Proposals=" & Proposals & ",Points =" & Points, connection)
Dim sqlDa As New SqlDataAdapter(sqlCmd)
sqlDa.Fill(dt)
lblError.Visible = True
lblError.Text = "Parameters successfully updated"
Catch SQLExp As SqlException
lblError.Visible = True
lblError.Text = "SQL Error: " + SQLExp.Message.ToString()
Finally
connection.Close()
End Try
GetParameters()
End Sub
Cheers,
Jonesy