scusate questo è tutto il codice:
int main(void)
{
HENV hEnv = NULL; // Env Handle from SQLAllocEnv()
HDBC hDBC = NULL; // Connection handle
HSTMT hStmt = NULL; // Statement handle
UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "parcheggio2"; // Data Source Name buffer "ACCESSdb"
UCHAR* szUID = NULL; // User ID buffer
UCHAR* szPasswd = NULL; // Password buffer
UCHAR szModel[6][128]; // Model buffer
SDWORD cbModel[ 6 ]; // Model buffer bytes recieved
//UCHAR szSqlStr[] = "delete * from accessi where IdAccessi = '3'"; // SQL string
UCHAR szSqlStr[120] = "insert into accessi values (4,'Baglio','Aldo',29,'cliente')"; // SQL string
//UCHAR szSqlStr[] = "UPDATE accessi SET nome = 'manuela' where IdAccessi = '4'"; // SQL string
//UCHAR szSqlStr[] = "UPDATE accessi SET nome = 'genoveffa' where contatore = 10"; // SQL string
RETCODE retcode; // Return code
SQLSMALLINT columns;
int i,r;
// Allocate memory for ODBC Environment handle
SQLAllocEnv (&hEnv);
// Allocate memory for the connection handle
SQLAllocConnect (hEnv, &hDBC);
// Connect to the data source "ACCESSdb" using userid and password.
retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
// Allocate memory for the statement handle
retcode = SQLAllocStmt (hDBC, &hStmt);
// Prepare the SQL statement by assigning it to the statement handle
retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));
// Execute the SQL statement handle
retcode = SQLExecute (hStmt);
// Free the allocated statement handle
SQLFreeStmt (hStmt, SQL_DROP);
// Disconnect from datasource
SQLDisconnect (hDBC);
}
// Free the allocated connection handle
SQLFreeConnect (hDBC);
// Free the allocated ODBC environment handle
SQLFreeEnv (hEnv);
// fine
system("pause");
return 0;
}
eventuale commit dove lo metto.