Bonjour à tous,

je voudrai éxécuter la fonction de changement de mot de passe : http://access.developpez.com/faq/?page=user#ChangerMDP
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
With DBEngine.Workspaces(0)
 .Users(.UserName).NewPassword "ancienmotdepasse", "nouveaumotdepasse"
End With
cette fonction marche très bien utilisé dans ACCESS. Mais je voudrai l'appeller dans du C#.

J'ai essayé d'utiliser deux méthodes et aucune des deux ne fonctionnent.

1)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
     string Conn = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/toto.mdb; Jet OLEDB:System Database=c:/toto.mdw; User Id="+login+"; Password="+PWD+";";
     System.Data.OleDb.OleDbConnection Con = new OleDbConnection(Conn);        
 
     System.Data.OleDb.OleDbCommand Cmd = new OleDbCommand(Request, Con);
 
     Con.Open();
     OleDbDataReader dr = Cmd.ExecuteReader();
     Con.Close();
Cela ne marche je ne peux qu'éxécuter du SELECT, INSERT, UPDATE ou DELETE.

2)
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
18
 
           string Conn = @"c:/toto.mdb";
 
            Acc.OpenCurrentDatabase(Conn, false, "");
 
            object oMissing = System.Reflection.Missing.Value;
            string P1 = login;
            Object P2 = P1;
            string P3 = oldPWD;
            Object P4 = P3;
            string P5 = NewPWD;
            Object P6 = P5;
 
 
            Object o = Acc.Run("ChangePWD", ref P2, ref P4, ref P6, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
 
            Acc.CloseCurrentDatabase();
            Acc.Quit(Access.AcQuitOption.acQuitSaveNone);
et là je peux éxécuter d'autre fonction mais pas celle-là!

pourquoi?

merci d'avance pour votre aide.

Cordialement.
ALCINA.