Resources | Resources |



Creating a table

Here a statement is being created, which will create the messages table when executed.

stmt = “CREATE TABLE messages \n" \
       "   (msgId INTEGER PRIMARY KEY, \n" \
       "    msgText varchar(256), \n" \
       "    userId INTEGER);";

/* Statement to create messages table */
nResult = dbc_IConnection_CreateStatement(piConnection, stmt, &piStatement);

Now the statement is ready for execution. Since this statement is not a query for which a set of results is expected, the ExecuteUpdate function is called to execute the command.

/* Execute the statement */
nResult = dbc IStatement_ExecuteUpdate(piStatement);

/* Table Created! */