Open System Services ODBC/MX Client Driver Manual for SQL/MX Release 3.2.1 (H06.26+, J06.15+)

odbc_Error(henv,hdbc,SQL_NULL_HSTMT);
}
st = SQLExecDirect(hstmt,(SQLCHAR
*)CreateTable,strlen(CreateTable));
if ( st != SQL_SUCCESS)
{
printf("Error in Create Table: GGTest\n");
odbc_Error(henv,hdbc,hstmt);
}
else
printf("Create tabel GGTest Successful\n");
st = SQLExecDirect(hstmt, (SQLCHAR
*)InsertTable,strlen(InsertTable));
if (st != SQL_SUCCESS)
{
printf("Error in Insert Table 1: GGTest\n");
odbc_Error(henv,hdbc,hstmt);
}
else
printf("Insert Succesfull: %d\n", value1);
memset(InsertTable, '\0', sizeof(InsertTable));
sprintf(InsertTable, "%s %d %s", "insert into GGTest(c1) values
(", value2, ");");
st = SQLExecDirect(hstmt,(SQLCHAR*)InsertTable,SQL_NTS);
if (st != SQL_SUCCESS)
{
printf("Error in Insert Table 2: GGTest\n");
odbc_Error(henv,hdbc,hstmt);
}
else
printf("Insert Succesfull: %d\n", value2);
st = SQLRowCount(hstmt,&RowCount);
if (st != SQL_SUCCESS)
{
printf("Error in SQLRowCount()\n");
odbc_Error(henv,hdbc,hstmt);
}
else
printf("Row(s) affected %d\n", RowCount);
st = SQLExecDirect(hstmt,(SQLCHAR
*)SelectTable,strlen(SelectTable));
if (st != SQL_SUCCESS)
{
printf("Error in Select Table: GGTest\n");
odbc_Error(henv,hdbc,hstmt);
}
st = SQLBindCol(hstmt, 1, SQL_C_SLONG, &value, 0, &ValInd);
if (st != SQL_SUCCESS)
{
printf("Error in SQLBindCol\n");
odbc_Error(henv,hdbc,hstmt);
}
while(TRUE)
{
if ((st = SQLFetch(hstmt)) == SQL_NO_DATA_FOUND)
break;
if ( (st != SQL_SUCCESS) && (st != SQL_SUCCESS_WITH_INFO) )
{
printf("Error in SQLFetch!!! Returned Status: %d\n", st);
break;
}
if (ValInd == SQL_NULL_DATA)
{
printf("No Data fetched!\n");
break;
58 Sample ODBC Application