Bonjour,

la fonction ci-dessous développée initialement sous SQL Server 2000 ne fonctionne plus sous SQL Server 2012.

Pouvez vous m'aider à rendre compatible cette fonction vers SQL Server 2012 notamment la partie SQLOLEDB.

Merci.


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
19
20
21
22
23
24
void CreerConnection(TADOConnection *MyConnect,TGlobal &VarGlobal)
{
    AnsiString ConnectChaine;
 
    TRY
    {
        TRY
        {
            // pour SQL Server 7.0
            ConnectChaine = "Provider=SQLOLEDB.1;Persist Security Info=True;Packet Size=4096;Use Procedure for Prepare=1;Auto Translate=True;";
            ConnectChaine += "User ID=" + VarGlobal.UserNameBase + ";Initial Catalog=" + VarGlobal.NomBaseET + ";";
            ConnectChaine += "Data Source=" + VarGlobal.NomServeurDonnees;
 
            MyConnect->ConnectionString = ConnectChaine;
 
            MyConnect->Open();
        }
        CATCH_ALL_AND_THROW()
    }
    CATCH(ETException* e)
    {
        THROW_INNER(ETException , "La connexion à la base de données a échoué");
    }
}