Bonjour à tous. voila j'ai un problème avec mon code a chaque fois que je le compile il me marque invalid conversion from `void*' to `SQLCHAR (*)[15]' a la ligne d'allocation de mémoire

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <cstdlib>
#include <iostream>
 
using namespace std;
 
int main(int argc, char *argv[])
{
     SQLHENV env;
 
    if ( !SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_ENV, NULL, &env)) )
        cout<<"La fonction SQLAllocHandle a echoue (SQL_HANDLE_ENV)."<<endl;
    else
    {
        if ( !SQL_SUCCEEDED(SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *)SQL_OV_ODBC3, 0)) )
            cout<<"La fonction SQLSetEnvAttr a echoue."<<endl;
        else
        {
            SQLHDBC con;
 
            if ( !SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_DBC, env, &con)) )
               cout<<"La fonction SQLAllocHandle a echoue (SQL_HANDLE_DBC)."<<endl;
            else
            {
                SQLCHAR dsn[] = "musique_andalouse";
 
                if ( !SQL_SUCCEEDED(SQLConnect(con, dsn, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS)) )
                    cout<<"La fonction SQLConnect a echoue."<<endl;
                else
                {
                    SQLHSTMT stmt;
 
                    if ( !SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_STMT, con, &stmt)) )
                        cout<<"La fonction SQLAllocHandle a echoue (SQL_HANDLE_STMT)."<<endl;
                    else
                    {
                        SQLCHAR req[] = "SELECT * FROM NOUBAT;";
                        if ( !SQL_SUCCEEDED(SQLExecDirect(stmt, req, SQL_NTS)) )
                            fprintf(stderr, "La fonction SQLExecDirect a echoue.\n");
                        else
                        {
                            SQLSMALLINT nbcolumns;
                            SQLCHAR (*columns) [15];
 
                            SQLNumResultCols(stmt, &nbcolumns);
 
                            columns = malloc (nbcolumns * sizeof(columns[0]));
                            if (columns != NULL)
                            {
                                printf("TABLE : PAYS_TBL\n\n");
 
                                while (SQL_SUCCEEDED(SQLFetch(stmt)))
                                {
                                    SQLSMALLINT i;
 
                                    for(i = 0; i < nbcolumns; i++)
                                    {
                                        SQLGetData(stmt, i + 1, SQL_C_CHAR, columns[i], sizeof(columns[i]), NULL);
                                        cout<<columns[i];
                                    }
 
                                    cout<<endl;;
                                }
 
                                free(columns);
                            }
                        }
 
                        SQLFreeHandle(SQL_HANDLE_STMT, stmt);
                    }
 
                    SQLDisconnect(con);
                }
 
                SQLFreeHandle(SQL_HANDLE_DBC, con);
            }
        }
 
        SQLFreeHandle(SQL_HANDLE_ENV, env);
    }
    system("PAUSE");
    return EXIT_SUCCESS;
}
j'ai vraiment besoin d'aide. Aussi j'ai essayé de le remplacer malloc par new en faisant columns = new (nbcolumns * sizeof(columns[0])); mais la encore il me marque cette erreur expected identifier before ';' token