Bon voila, je dois creer une fonction qui creer des tables dans une base de donnee MYSQL, la connexion fonctionne, mais lorsque j'appel les fonctions
  • SQLExecute
  • SQLExecDirect


Le pc me retourne une erreur systeme... Je ne vois pas ou est mon erreur ...

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
void CMysqlDatabase::createTable()
{
	SQLRETURN sqlResult;
	SQLHSTMT hStmtReq;
 
	// Variable for error 
	SQLSMALLINT errMsgLen;
	SQLINTEGER errNative;
	UCHAR errMsg[255];
	UCHAR errState[5];
 
	if(bConnexion)
	{ 
		cout<<"connect"<<endl;
		SQLAllocStmt(hDBC, &hStmtReq);
		// SQL statements
		SQLCHAR createTableEmplStmt[255] = "CREATE TABLE EMPLOYE ( ID_EMPLOYE varchar2(20), NAME varchar2(20), ADRESS varchar2(100), EMAIL varchar2(100), MOBILE varchar2(10));";
 
 
		// Execute the statement
		sqlResult = SQLPrepare(hStmtReq, (SQLCHAR*) createTableEmplStmt, SQL_NTS);
 
		sqlResult = SQLExecute(hStmtReq);
//		sqlResult = SQLExecDirect(hStmtReq, (SQLCHAR*) createTableEmplStmt , SQL_NTS);
		if (sqlResult != SQL_SUCCESS)
		{
			// Get the status record
			SQLGetDiagRec(SQL_HANDLE_DBC, hDBC, 1, errState, &errNative, errMsg, sizeof(errMsg), &errMsgLen); 
			// Display the error, its code and message
			printf("Creation of the table EMPLOYE failed \n SQLSTATE code : %s \n Native error code : %s \n Error Message Text : %s\n",  errState, errNative, errMsg );
		}
		sqlResult = SQLFreeHandle(SQL_HANDLE_STMT, hStmtReq);
	}
	else
		cout<<"Pas connecter"<<endl;
PS : J'espere etre dans la bonne section ^^