From: Enricko Chivaldory on
I have a simple GridView with multiple columns from a Sql table. I have
only
1 data column that I want to update (a date column) without having to
have
the user click an Edit button, edit the date and click the update
button. I
have the GridView wrapped in an UpdatePanel and have the code below in
the
TextChanged event of the TextBox. I think it may work if I can get the
key
value of the row I am on. Any help is appreciated. Thanks.

Protected Sub txtCompleteDate_TextChanged(ByVal sender As Object,
ByVal
e As System.EventArgs)
Dim intKey As Int32 = 0

Dim tb As TextBox = CType(sender, TextBox)
Dim dtNewDate As Date = Convert.ToDateTime(tb.Text)
Using conData As SqlConnection = New
SqlConnection(DBClass.GetCoreConnectionString)
conData.Open()
Dim strSQL As String = "UPDATE dbo.ApplicantRequirements" &
_
" SET CompleteDate='" &
dtNewDate.ToShortDateString & "'" & _
" WHERE ApplicantReqID = " &
intKey.ToString
End Using

End Sub
--
Enricko Chivaldory
<a href="http://pro-software.biz">pro software reviews</a>

*** Sent via Developersdex http://www.developersdex.com ***