Hp Integrity NonStop H-Series Manual de usuario Pagina 58

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 62
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 57
}
else
printf("Connection 2 Successful\n");
st =
SQLConnect(hdbc2,(SQLCHAR*)serverName,SQL_NTS,(SQLCHAR*)UserID,
SQL_NTS,(SQLCHAR*)Password,SQL_NTS);
if (st != SQL_SUCCESS)
{
printf("Error in Connection 3\n");
odbc_Error(henv,hdbc,SQL_NULL_HSTMT);
}
else
printf("Connection 3 Successful\n");
st = SQLGetInfo(hdbc,SQL_DBMS_NAME, infoValueBuf,
sizeof(infoValueBuf), &StringLengthPtr);
infoValuePtr = infoValueBuf;
if (st != SQL_SUCCESS)
{
printf("Error in SQLGetInfo\n");
odbc_Error(henv,hdbc,hstmt);
}
else
printf("\n\tDBMS NAME : %s\n\n", infoValuePtr);
printf("\n\tUsing Connection 1\n\n");
st = SQLAllocHandle(SQL_HANDLE_STMT, (SQLHDBC)hdbc, &hstmt);
if (hstmt == NULL)
{
printf("Error in allocating Statement Handle\n");
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 table 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 Successful: %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 Successful: %d\n", value2);
st = SQLRowCount(hstmt,&RowCount);
if (st != SQL_SUCCESS)
{
printf("Error in SQLRowCount()\n");
odbc_Error(henv,hdbc,hstmt);
}
58 Sample ODBC application
Vista de pagina 57
1 2 ... 53 54 55 56 57 58 59 60 61 62

Comentarios a estos manuales

Sin comentarios