IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Accès aux données Discussion :

OleDb : Spécification de permission non valide


Sujet :

Accès aux données

  1. #1
    Membre éprouvé Avatar de star
    Homme Profil pro
    .
    Inscrit en
    Février 2004
    Messages
    841
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Corée Du Nord

    Informations professionnelles :
    Activité : .

    Informations forums :
    Inscription : Février 2004
    Messages : 841
    Points : 981
    Points
    981
    Par défaut OleDb : Spécification de permission non valide
    J'essaye désespérément d'accéder à une base Access avec ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
                {
                    IDbConnection ctn;
                    // string strConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Uid=administrateur;Pwd=;Dbq=C:\\Users\\raymond\\Documents\\CSharpBase\\Test.mdb";
                    string strConnectionString = "Provider=SQLOLEDB;Data Source=C:\\Users\\raymond\\Documents\\CSharpBase\\Test.mdb";
                    // ctn = new OdbcConnection(strConnectionString);
                    ctn = new OleDbConnection(strConnectionString);
                    ctn.Open();
                    IDbCommand cmd;
                    cmd = ctn.CreateCommand();
                    cmd.CommandText = "select * from Employes";
                    IDataReader lec;
                    lec = cmd.ExecuteReader();
                    Console.WriteLine("Lecture des donnees dans la table Employes");
                    while (lec.Read())
                        Console.WriteLine("Emp_ID : {0}, Nom : {1}, Sexe : {2}", lec.GetString(0), lec.GetString(1), lec.GetString(2));
                    ctn.Dispose();
                }
    Visual Studio (version 2008) lève une exception sur l'instruction ctn.Open(); Voir captures d'écran.
    J'ai aussi quelques difficultés avec le fournisseur de données ODBC.

    Votre aide me serait d'un grand secours
    Merci d'avance

    config :
    Windows 7
    Visual Studio 2008
    MS Access 2007
    .
    Images attachées Images attachées    
    Diviser c'est régner : United we stand, Divided we fall
    .

  2. #2
    Rédacteur/Modérateur
    Avatar de Skalp
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2006
    Messages
    1 694
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 694
    Points : 2 927
    Points
    2 927
    Par défaut
    Le fournisseur Jet OleDb 4.0 n'est pas installé sur Windows 7.
    Tu peux télécharger et installer Microsoft Access Database Engine 2010 Redistributable : http://www.microsoft.com/en-us/downl....aspx?id=13255

    Si tu es sur un environnement 64 bits, ce lien pourrait aider : http://connectionstrings.com/Article...t-environments
    Citation Envoyé par connectionstrings
    Introduction
    -----------
    The Microsoft OLE DB Provider for Jet and the Jet ODBC driver are available in 32-bit versions only. You can't run them in 64 bit mode.

    For example, you have a 32-bit application that uses the Microsoft OLE DB Provider for Jet. If you migrate the application to run in the 64-bit mode, the application cannot connect to the data source by using the Microsoft OLE DB Provider for Jet. This issue occurs because the application requires a 64-bit version of the Microsoft OLE DB Provider for Jet. Note also that a website can be either an 32 bit or 64 bit application.

    The Solution
    ------------
    If you run a program in a 64 bit environment and need to utilize jet to open an access, excel or text file there are several options to make this work.

    Run the program in WoW64 mode (emulates 32-bit on 64 bit systems). This will make the 32 bit drivers work.
    If the application is an web app hosted on IIS 7 you can choose to configure the web sites application pool to run in 32-bit mode.
    With the new Office 2010, there will be new drivers coming, "2010 Office System Driver", which will be provided as booth 32-bit and 64-bit versions. You can use these drivers to let you application connect to Access, Excel and text-files in a 64 bit environment, utilizing the new 64 bit drivers. The provider name is "Microsoft.ACE.OLEDB.12.0". You don't need to buy or install the Office suite, the components are available as a separate download.
    http://www.microsoft.com/downloads/d...displaylang=en

    Summary
    ---------
    It is possible to open Excel, Access and text files on 64 bit systems.
    You can either configure your app to go 32-bit or you can change your application to use the new 64 bit drivers.

  3. #3
    Membre éprouvé Avatar de star
    Homme Profil pro
    .
    Inscrit en
    Février 2004
    Messages
    841
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Corée Du Nord

    Informations professionnelles :
    Activité : .

    Informations forums :
    Inscription : Février 2004
    Messages : 841
    Points : 981
    Points
    981
    Par défaut
    Au moins c'est clair on ne risque pas de se tromper :7
    En tout cas merci beaucoup
    .
    Diviser c'est régner : United we stand, Divided we fall
    .

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 26/05/2011, 22h22
  2. SQL et GUID : Valeur de caractère non valide pour la ....
    Par jackfirst72 dans le forum Bases de données
    Réponses: 5
    Dernier message: 06/03/2007, 10h46
  3. Réponses: 7
    Dernier message: 07/03/2006, 09h34
  4. [Tomcat5] Insertion photo ds pdf. Chemin non valide?
    Par osmoze dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 21/09/2004, 11h12
  5. TThread et waitfor - descripteur non valide
    Par code34 dans le forum Langage
    Réponses: 2
    Dernier message: 27/10/2003, 23h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo