[English version available further below] Démonstration Time Entry Application pour ASP avec Access ou SQL-Server ======================================================================= par PhilFlash http://philflash.inway.fr Macromedia a publié une démonstration Time Entry qui permet de lire et d'écrire dans une base de données mais surtout d'analyser les résulats d'un updatePacket pour remettre à jour l'application Flash en cas d'erreur. Cette démonstration utilise ColdFusion MX et est disponible à l'adresse suivante : http://www.macromedia.com/devnet/mx/flash/articles/time_entry.html Voici cette démonstration en ASP (active Server Page) avec Access ou SQL-Server. Pre-requis =========== - serveur IIS - Access ou SQL-Server - Recommandé : Installer MSXML 4.0 SP2 Release Notes voir http://msdn.microsoft.com/xml Installer la version française Installation avec Access ======================== - Dézipper le tout dans un répertoire - Créer un lien ODBC de nom "TimeEntry" avec un DSN Système (Source de données système) de type Access pointant sur la base data/TimeEntry.mdb - Créer un répertoire virtuel avec IIS de nom 'time_entry_asp' pointant vers le répertoire iis/time_entry_asp de la livraison - Vérifier le fichier iis/time_entry_asp/connection.inc (si vous avez modifié le nom du DSN) - Lancer l'application Installation avec SQL-Server ============================ - Transférer la base Access dans SQL-Server . Lancer Access avec la base TimeEntry.mdb . Choisir Outils > Utilitaires de base de données > Assistant de migration SQL-Server . Choisir : Créer une nouvelle base de données et cliquez sur Suivant . Dans "Donner un nom à votre nouvelle base de données", choisissez un nom ou laisser le nom par défaut : TimeEntrySQL . Dans "Quelles tables souhaitez-vous exporter", cliquez sur contact et le bouton ">" . Dans la page suivante, champ "Quelles données souhaitez-vous inclure" choisissez "Non, jamais" pour l'option "Ajoutez des champs d'horodatage aux tables" et l'option "Créer seulement la structure de la table" ne doit pas être cochée. . Dans la page suivante, choisissez "Pas de modifications pour l'application" . cliquez sur "Terminer" - Lancer "Entreprise Manager" pour SQL-Server . Vérifier que la base de données "TimeEntrySQL" existe et que la table contient bien des enregistrements . Ajouter l'utilisateur IUSR_XXX dans Utilisateurs (pour IIS) .IMPORTANT: Cliquez sur le nouvel utilisateur YYY\IUSR_XXX puis Propriétés et sélectionnez db_datareader et db_datawriter pour "Membre du rôle de base de données" (Nous vous recommandons de prendre contact avec votre administrateur SQL-Server pour une meilleure installation de la base) - Créer un lien ODBC de nom "TimeEntrySQL" avec un DSN Système (Source de données système) de type SQL-Server pointant sur la base TimeEntrySQL (dans l'option "changer la base de données par défaut") - Dézipper l'archive dans un répertoire - Créer un répertoire virtuel avec IIS de nom 'time_entry_asp' pointant vers le répertoire iis/time_entry_asp de la livraison - Vérifier le fichier iis/time_entry_asp/connection.inc Il doit y avoir : <% Dim DB_connection ' -- example with DSN -- DB_connection = "dsn=TimeEntrySQL" %> - Lancer l'application Lancement de l'application ========================== - Lancer Microsoft Internet Explorer et entrer comme URL: http://localhost/time_entry_asp/TimeEntry.html - Cliquer sur Load pour charger les enregistrements de la base - Vous pouvez créer, modifier ou supprimer des enregistrements. Cliquer sur Save pour sauver vos modifications Cliquez sur Load pour recharger la base - Pour créer des erreurs et visualiser les undo . Créer, modifier ou supprimer des enregistrements. . Cliquer sur "Save With Error" pour sauver vos modifications . Une fenêtre "Reconcile Dialog" apparait. . Pour anuuler une modification, cochez l'option "Discard this change" Liste des modifications apportées ================================= - on utilise les ADO pour mettre à jour la base de données Access ou SQL-Server => on a modifié la méthode rdbmsTimeEntryBeforeApplyUpdatesHandler de TimeEntryData.as (pour le nom date et les formats de date) - on utilise le format de date ISO YYYY-MM-DD pour être compatible Access et SQL-Server et être indépendant du pays et du format de date de la machine - on a ajouté un bouton "Save With Error" pour générer des erreurs (méthode rdbmsTimeEntryBeforeApplyUpdatesHandler de TimeEntryData.as) => pour les opérations de type update et insert, on modifie le nom des champs en les préfixant par "BUG_" => pour les opérations de type delete, on modifie le nom de l'ID en le préfixant par "BUG_" - dans l'écran "dmTimeEntry", on a modifié les WebServiceConnector en XmlConnector - Seuls deux fichiers ont été modifiés : TimeEntry.as et TimeEntryData.as Les lignes qui ont été modifiées sont préfixées par : // PhilFlash Remarques ========= - Le fichier iis/time_entry_asp/getdataTimeEntry.asp utilisent les types déclarés par : Sur Windows 98, ceci n'est pas défini. Remplacé cette ligne par : Bons tests... PhilFlash http://philflash.inway.fr philflash@inway.fr ===================================================================== ===================================================================== Time Entry Application in ASP with Access or SQL-Server ======================================================= by PhilFlash http://philflash.inway.fr Macromedia has published the Time Entry sample application which makes reading and writing into a database possible but also allows analyzing the result of an updatePacket in order to refresh the flash application in case of error. This demonstration uses ColdFusion MX and is available at the following url: http://www.macromedia.com/devnet/mx/flash/articles/time_entry.html Here is this demonstration in ASP (Active Server Page) with an Access or SQL-Server database. Requirements =========== - Server IIS. - Access or SQL-Server. - Recommended: Install MSXML 4.0 SP2 Release Notes see http://msdn.microsoft.com/xml Installation with Access ======================== - Unzip the whole package into a separate directory. - Create an ODBC link named "TimeEntry" with DSN System (System Data Source) of type Access pointing to the database data/TimeEntry.mdb - Create a virtual directory with IIS named 'time_entry_asp' pointing to 'contactasp' to 'iis/time_entry_asp' in the delivery directory. - Check the file 'iis/time_entry_asp/connection.inc' (if you have changed the name of the DSN). - Run the application. Installation with SQL-Server ============================ - Transfer the Access database to SQL-Server: (for more information, see http://support.microsoft.com/support/kb/articles/Q237/9/80.ASP HOW TO: Convert an Access Database to SQL Server) French commands translated here: . Run Access with TimeEntry.mdb. . Choose Tools > Database Utilities > SQL-server Migration Wizard. . Choose Create a new DB and press Next. . In Name your new DB, choose a name or keep the default name: TimeEntrySQL. . In Which tables do you wish to export", click on TimeEntry then >. . On the next page, field What data do you wish to include, choose No, never for the option Add time fields to tables and make sure the option Create only the table structure is checked off. . On the next page, choose No modifications for the application. . Push Finish. - Run the Enterprise Manager for SQL-Server: . Check that the DB "TimeEntrySQL" exists and that the table is filled with records. . Add the user IUSR_machine in Users (for IIS). . IMPORTANT: Click on the new user YYY\IUSR_machine then click on Properties and select db_datareader and db_datawriter for DB role member. (You should get in touch with your SQL-Server administrator for a better installation). - Create an ODBC link named "TimeEntrySQL" with DSN System (System Data Source) of type SQL-Server pointing to the DB TimeEntrySQL (in the option Change the default DB. - Unzip the whole package into a separate directory. - Create a virtual directory with IIS named 'time_entry_asp' pointing to 'iis/time_entry_asp' in the delivery directory. - Edit the file 'iis/time_entry_asp/connection.inc'. It must contain: <% Dim DB_connection ' -- example with DSN -- DB_connection = "dsn=TimeEntrySQL" %> - Run the application. Running the application ======================= - Run a browser and enter the following URL: http://localhost/time_entry_asp/TimeEntry.html - Click on Load to list the DB records. - You can create, modify or delete records. . Click on Save to write the changes. . Click on Load to reload the DB records. - To generate errors and show undo operations: . Create, modify or delete records. . Click on Save With Error to write your changes. . An error panel "Reconcile Dialog" is displayed. . To cancel the changes, check the option Discard this change. List of the modifications made ============================== - We use ADO to allow updating the DB Access or SQL-Server. => We changed the method rdbmsTimeEntryBeforeApplyUpdatesHandler of TimeEntryData.as (for the date name and date format) - We use the date format ISO YYYY-MM-DD in order to be compatible with Access and SQL-Server and independent of the country and system date format. - We added a button Save With Error in order to generate errors (method rdbmsTimeEntryBeforeApplyUpdatesHandler of TimeEntryData.as). => For update or insert operations, we add "BUG_" ahead of the field names. => For delete operations, we add "BUG_" ahead of the ID name. - In the screen "dmTimeEntry", we replaced WebServiceConnector by XmlConnector. - Just two files were changed: TimeEntry.as and TimeEntryData.as. The lines which were modified start with // PhilFlash Remarks ======= - The file 'iis/time_entry_asp/getdataTimeEntry.asp' uses the types declared by: On Windows 98, this is not defined. Replace this line by: Bons tests... PhilFlash http://philflash.inway.fr philflash@inway.fr