I have implemented the code in a slightly different way shown below: private void DiagnosisListDataGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { int DiagnosisNo = (int) DiagnosisListDataGrid.DataKeys[(int) e.Item.ItemIndex]; string nino = ((TextBox)e.Item.Cells[3].Controls[0]).Text; string datetime = ((TextBox)e.Item.Cells[4].Controls[0]).Text; string details = ((TextBox)e.Item.Cells[5].Controls[0]).Text; string currentstatus = ((TextBox)e.Item.Cells[6].Controls[0]).Text; string sql = "UPDATE DIAGNOSIS SET NINo=@nino, [DateTime]=@datetime, Details=@details, CurrentStatus= " + " @currentstatus WHERE DiagnosisNo= @DiagnosisNo"; OleDbCommand cmd = new OleDbCommand(sql); cmd.Parameters.Add("@nino", nino); cmd.Parameters.Add("@datetime", datetime); cmd.Parameters.Add("@details", details); cmd.Parameters.Add("@currentstatus", currentstatus); ExecuteNonQuery(sql); DiagnosisListDataGrid.EditItemIndex = -1; ReadRecords(); } This has got rid of all the build errors but now when I attempt to use the update function in the browser, the following error is returned: Server Error in '/GP' Application. -------------------------------------------------------------------------------- No value given for one or more required parameters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters. Source Error: Line 148: OleDbCommand cmd = Line 149: new OleDbCommand(sql, conn); Line 150: cmd.ExecuteNonQuery(); Line 151: } Line 152: // catch (Exception e) Source File: c:\inetpub\wwwroot\gp\diagnosislist.aspx.cs Line: 150 Stack Trace: [OleDbException (0x80040e10): No value given for one or more required parameters.] System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41 System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174 System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92 System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65 System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112 System