Hello,
I am trying to update a mySQL database via ASP.NET 2.0. The update never saves the new values. I am using an ENUM('True','False') datatype in the mySQL table for the rejectflag variable. Any help would be appreciated!!!
Here is my code:
'script
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="cEvaluateSRBLL" SelectMethod="SelectSR"
UpdateMethod="UpdateSR" OldValuesParameterFormatString="original_{0}">
<UpdateParameters>
<asp:Parameter Type="string" Direction="Input" Name="rejectflag" />
<asp:Parameter Type="string" Direction="Input" Name="newcomments" />
<asp:Parameter Type="Int32" Name="original_sid" />
<asp:ProfileParameter Type="Int32" PropertyName="UID" Name="original_uid" />
</UpdateParameters>
<SelectParameters>
<asp:ProfileParameter Name="uid" PropertyName="UID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
.....
'vb object
Public Function UpdateSR(ByVal rejectflag As String, ByVal newcomments As String, _
ByVal original_sid As Integer, ByVal original_uid As Integer) As Boolean
Dim myComm As OdbcCommand = New OdbcCommand()
Dim myConn As OdbcConnection = New OdbcConnection()
myConn.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString()
myConn.Open()
myComm.Connection = myConn
myComm.CommandType = Data.CommandType.Text
myComm.CommandText = "UPDATE approval SET flag = 'O', rejectflag = '" & rejectflag & "', comments = '" & newcomments & "' WHERE sid = " & original_sid & " AND uid = " & original_uid
myComm.ExecuteNonQuery()
'clean up
myConn.Close()
myConn = Nothing
myComm = Nothing
GC.Collect()
Return True
End Function
ASKER
I forgot the DataKeysNames property in the Gridview! Duh! Thanks anyway mankowitz!