public void EditRow(Position positions, int index) { DataRow selectedRow = dataSet.Tables["JoinPosition"].Rows[index]; selectedRow["PositionID"] = positions.PositionID; selectedRow["PositionName"] = positions.PositionName; selectedRow["Salary"] = positions.Salary; EditRecord(positions, index); }
public void DeleteRow(Position positions, int index) { DataRow selectedRow = dataSet.Tables["JoinPosition"].Rows[index]; selectedRow.Delete(); DeleteRecord(positions, index); }
public void AddRecord(Position positions) { connection.Open(); //set up command SqlCommand command = new SqlCommand("cprocedureInsertPosition", connection); //set up commandType command.CommandType = CommandType.StoredProcedure; //set up parameters //command.Parameters.AddWithValue("@PositionID", positions.PositionID); command.Parameters.AddWithValue("@PositionName", positions.PositionName); command.Parameters.AddWithValue("@Salary", positions.Salary); command.ExecuteNonQuery(); connection.Close(); }
private void EditRecord(Position positions, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "cprocedureUpdatePosition"; dataAdapter.UpdateCommand = command; command.Parameters.AddWithValue("@PositionID", positions.PositionID); command.Parameters.AddWithValue("@PositionName", positions.PositionName); command.Parameters.AddWithValue("@Salary", positions.Salary); dataAdapter.Update(dataSet, "JoinPosition"); }
private void DeleteRecord(Position position, int index) { SqlCommand command = new SqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "cprocedureDeletePosition"; dataAdapter.DeleteCommand = command; command.Parameters.AddWithValue("@PositionID", position.PositionID); dataAdapter.Update(dataSet, "JoinPosition"); }
public FormPosition() { InitializeComponent(); admin = new Admin(); positions = new Position(); }