Kbase 13406: How to use DATE column in ESQL/C version 7
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to use DATE column in ESQL/C version 7
The following code gives an example how to insert a row with a date.
#include <stdio.h>
/* Add table "test", and column "test_date" to a database */
main(argc,argv)
int argc;
char *argv[];
{
long SQLCODE;
char *msg;
EXEC SQL BEGIN DECLARE SECTION;
sqldate xdate;
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER SQLERROR GOTO err;
if (sqllogin(argc-1, &argv[1], "", "") == -1) {
printf(" Could not login to Progress HLI.\n " );
exit(0);
}
strcpy(xdate, "08/26/1994");
EXEC SQL INSERT INTO test (test_date) VALUES (:xdate);
goto done1;
err:
printf("Error occured.\n");
while ((msg = (char *) sqlgetmsg()) != (char *) 0)
printf("%s\n",msg);
printf("\nRolling back all work...\n");
EXEC SQL ROLLBACK WORK;
sqllogout(0);
exit(0);
done1:
EXEC SQL COMMIT WORK;
sqllogout(0);
return 0;
}
Progress Software Technical Support Note # 13406