10.07.2015 Views

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

pdf - 395 K - Ecole des mines de Nantes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

using System.Data.SqlClient;namespace Architecture.Profiles{/// /// Utility class for data management by ADO./// internal class DataUtilities{tableName,/// /// Deletes all data from the specified table in the database./// /// /// /// public static void CleanupTable(SqlConnection connection,string tableName){SqlCommand command = new SqlCommand("DELETE FROM " +}connection);command.ExecuteNonQuery();/// /// Fills a DataSet with content of a table through aConnection and creates/// and returns a DataAdapter./// /// /// /// /// public static SqlDataAdapter InitializeTable(DataSet dataSet,SqlConnection connection, string tableName){SqlDataAdapter adapter = new SqlDataAdapter();adapter.MissingSchemaAction =MissingSchemaAction.AddWithKey;// Create commandsstring commandText = "SELECT * FROM " + tableName;adapter.SelectCommand = new SqlCommand(commandText,connection);SqlCommandBuil<strong>de</strong>r buil<strong>de</strong>r = newSqlCommandBuil<strong>de</strong>r(adapter);// Fill datasetadapter.Fill(dataSet, tableName);}return adapter;}}24. Class Architecture.Profiles.UP – User Profileusing System;using System.Collections;MSc EMOOSE Thesis – http://www.emn.fr/EMOOSE 112

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!