Accueil   |   Forums   |  Offres d'emplois   |  Contact    |   Mon compte   
samedi 30 août 2008 Rechercher :
Déposez votre CV gratuitement sur touslesemplois
 
comparer les prix
» Logiciels
» Jeux vidéos
» Matériel Informatique


» ASP.NET
» ASP
» SQL
» PHP
» JAVASCRIPT
» XML
 


» ACTUALITÉ / DIVERS
» DROIT DE L'INTERNET
» INFOS VIRUS
» PATCHS MICROSOFT
» SÉCURITÉ
» BASES DE DONNÉES
» DOWNLOAD .NET
» LOGITHÈQUE
» SERVICES WEB
» Y SONT FOUS !
» .NET
» ASP
» ASP.NET
» JAVA
» PHP
» XML
» LANGAGE C#
» LANGAGE VB.NET
» UNIX / LINUX
» WINDOWS
» EVÈNEMENTS
» GASP
» MICROSOFT
 


Vous êtes ici : Forums > Langage SQL > Requêtes Access vers SQL Server 2000

Requêtes Access vers SQL Server 2000
Bonjour à tous,

J'administre un petit site de quizz en ligne dans ma boite et ce dernier s'appuie sur une base Access97. Tout fonctionne super bien mais je vais très certainement avoir besoin de migrer ma base Access sur SQL server.

Je me suis alors lancé dans cette migration vers SqlServer (après conversion en Access2000) et la majorité de mes pages fonctionnent correctement (d'ailleurs je suis tout content d'avoir ce masque "Access" afin de ne pas trop être perdu).

En revanche certaines requêtes plantent (alors qu'elles fonctionnaient nickel avec Access) et très souvent j'ai comme erreur que ">" ou "=" ou "<" représentent des pb de syntaxe ?!?!?

Par exemple, avec cette requête :

Code:
sql="SELECT TQuizz.NumQuizz, [TYPESDEFORMATION].CodeModule, TQuizz.TitreQuizz, TQuizz.QuizzSupprON, Sum(IIf(([N°ELEVE]=" & Session("NumEleve") & " And IIf([QuizzReussiON]=-1,-1,0)=-1),-1,IIf([NumEleveFormation]=" & Session("NumStagiaire") & " And IIf([QuizzReussiOn]=0,-1,0)=-1,-1,0))) AS DejaReussiOuFaitSurMemeFormation FROM [TYPESDEFORMATION] LEFT JOIN ([ELEVESPARFORMATION] RIGHT JOIN (TQuizz LEFT JOIN TRepQuizz ON TQuizz.NumQuizz = TRepQuizz.ReportNumQuizz) ON [ELEVESPARFORMATION].NumEleveFormation = TRepQuizz.CodeEleveFormation) ON [TYPESDEFORMATION].REFERENCE = TQuizz.CodeReference GROUP BY TQuizz.NumQuizz, [TYPESDEFORMATION].CodeModule, TQuizz.TitreQuizz, TQuizz.QuizzSupprON HAVING ((([TYPESDEFORMATION].CodeModule)=" & "'" & Session("CodeModule") & "'" & ") AND ((Sum(IIf(([N°ELEVE]=" & Session("NumEleve") & " And IIf([QuizzReussiON]=-1,-1,0)=-1),-1,IIf([NumEleveFormation]=" & Session("NumStagiaire") & " And IIf([QuizzReussiOn]=0,-1,0)=-1,-1,0))))=0));"


j'ai le message d'erreur suivant sous l'analyseur de requête Sql (ou le navigateur d'ailleurs) :

Code:
Serveur : Msg 170, Niveau 15, État 1, Ligne 2
Ligne 2 : syntaxe incorrecte vers '='.


Qqu'un aurait-il une explication à cela ?

Merci d'avance :( :( :(

Message posté le 31/05/2003 par chucky

Répondre à ce message
 
AuteurRéponse 
madbison
04/06/2003
RE : Requêtes Access vers SQL Server 2000
Est tu sur ke IIF fonctionne sous SQLServer ??? Regarde les fonctions propre a ACCESS que tu utilise dans tes requete et regarde si elle sont "compatible" SQLServer ! :-( ...
Répondre
chucky
06/06/2003
RE : RE : Requêtes Access vers SQL Server 2000
Effectivement, il faut remplacer le IIf par l'instruction WHEN CASE.

J'ai plusieurs requetes en IIF et après modification, elles fonctionnent................sauf la requete que j'ai posté.....la requete est plus complexe...........avec les "Sum", je n'arrive pas à la convertir correctement

En résumé, j'ai besoin d'aide :( ...
Répondre
kamelbedghiou
05/12/2007 16:35:43
RE : Requêtes Access vers SQL Server 2000
using System;
using System.Data;
using System.Data.Common;
using System.Configuration;

/// <summary>
/// Class contains generic data access functionality to be accessed from
/// the business tier
/// </summary>
public static class GenericDataAccess
{
// static constructor
static GenericDataAccess()
{
//
// TODO: Add constructor logic here
//
}

// execute a command and return the results as a DataTable object
public static DataTable ExecuteSelectCommand(DbCommand command)
{
// The DataTable to be returned
DataTable table;
// Execute the command making sure the connection gets closed in the end
try
{
// Open the data connection
command.Connection.Open();
// Execute the command and save the results in a DataTable
DbDataReader reader = command.ExecuteReader();
table = new DataTable();
table.Load(reader);
// Close the reader
reader.Close();
}
catch (Exception ex)
{
Utilities.LogError(ex);
throw ex;
}
finally
{
// Close the connection
command.Connection.Close();
}
return table;
}

// execute an update, delete, or insert command
// and return the number of affected rows
public static int ExecuteNonQuery(DbCommand command)
{
// The number of affected rows
int affectedRows = -1;
// Execute the command making sure the connection gets closed in the end
try
{
// Open the connection of the command
command.Connection.Open();
// Execute the command and get the number of affected rows
affectedRows = command.ExecuteNonQuery();
}
catch (Exception ex)
{
// Log eventual errors and rethrow them
Utilities.LogError(ex);
throw ex;
}
finally
{
// Close the connection
command.Connection.Close();
}
// return the number of affected rows
return affectedRows;
}

// execute a select command and return a single result as a string
public static string ExecuteScalar(DbCommand command)
{
// The value to be returned
string value = "";
// Execute the command making sure the connection gets closed in the end
try
{
// Open the connection of the command
command.Connection.Open();
// Execute the command and get the number of affected rows
value = command.ExecuteScalar().ToString();
}
catch (Exception ex)
{
// Log eventual errors and rethrow them
Utilities.LogError(ex);
throw ex;
}
finally
{
// Close the connection
command.Connection.Close();
}
// return the result
return value;
}

// creates and prepares a new DbCommand object on a new connection
public static DbCommand CreateCommand()
{
// Obtain the database provider name
string dataProviderName = BalloonShopConfiguration.DbProviderName;
// Obtain the database connection string
string connectionString = BalloonShopConfiguration.DbConnectionString;
// Create a new data provider factory
DbProviderFactory factory = DbProviderFactories.GetFactory(dataProviderName);
// Obtain a database specific connection object
DbConnection conn = factory.CreateConnection();
// Set the connection string
conn.ConnectionString = connectionString;
// Create a database specific command object
DbCommand comm = conn.CreateCommand();
// Set the command type to stored procedure
comm.CommandType = CommandType.StoredProcedure;
// Return the initialized command object
return comm;
}
}
...
Répondre


Project Hoshimi


A RETENIR CETTE SEMAINE
16/07/2008 - Windows Server 2008 : Network Access Protection
Le nouveau système d’exploitation serveur de Microsoft, Windows Server 2008, apporte avec lui de nou ...
16/07/2008 - Webcasts - Développement parallèle, à l'aube d'une nouvelle ère
Avec l'avénement des multi-coeurs, le développement parallèle devient une necéssité. Dans cette séri ...
16/07/2008 - J'en ai rien à coder - Votre devoir de vacances sur Silverlight !
Qu'est-ce que Silverlight ? Une nouvelle technologie Web permettant d'exécuter des RIA sur un large ...
16/07/2008 - Quelques petits tests sur les bases embarquées
Dans ce billet, Ayende réalise un benchmarking de plusieurs "petites" bases de données embarquées. S ...
15/07/2008 - Présentation d'ASP.NET Dynamic Data
Dynamic Data est une nouvelle technologie inclue dans l' "Asp.net 3.5 Extension CTP ". Elle fournit ...
15/07/2008 - Silverlight 2 - Les webcasts de l'événement sont en ligne
L’objectif de cette journée était de comprendre les limitations de Silverlight 1, et d’appréhender l ...
15/07/2008 - Cache transparent et Entity Framework
La gestion du cache (1er et second niveau) est une fonctionnalité très importante d'un outil de mapp ...
(c) 1999-2006 ASP MAGAZINE SARL
Partenaires : Codes sources c2i ASP-PHP
Hébergement serveurs dédiés Windows


Hit-Parade