Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2004, 09:35 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting Error 'EXEC' : undeclared identifier

I am trying to compile code below in Microsoft visual c++.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>

    using std::ifstream;

    using std::ofstream;

#include <iostream>

    using std::ios;

    using std::cout;

    using std::endl;


/* DB2 ODBC Header */
#include <sqlenv.h>
#include <sqlca.h>


int main ()
{
    char dbname[15] ;
    char user[128 + 1] ;
    char pswd[15] ;

    strcpy (dbname, "DB2HNB1");
    strcpy (user, "STORBIT");
    strcpy (pswd, "TOUCHP2");
    EXEC SQL CONNECT TO :dbname USER :user USING :pswd;
    if (SQLCODE != 0) {
        printf ("\n *** Error ***\n");
        exit (0);
    }
    else {
        printf ("\n Successful connection to '%s' db using C
        embedded static SQL\n",dbname);
    }

    return 0;

}

I can not figure out why I am getting this error:

:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2065: 'EXEC' : undeclared identifier
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2146: syntax error : missing ';' before identifier 'SQL'
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2065: 'SQL' : undeclared identifier
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2146: syntax error : missing ';' before identifier 'CONNECT'
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2065: 'CONNECT' : undeclared identifier
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2146: syntax error : missing ';' before identifier 'TO'
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2146: syntax error : missing ';' before identifier 'USER'
C:\db2odbcproject3\db2odbcproject3.cpp(37) : error C2146: syntax error : missing ';' before identifier 'USING'
Error executing cl.exe.

Please help..







Similar Threads
Thread Thread Starter Forum Replies Last Post
<identifier> expected error sprinkle Java Basics 1 February 11th, 2007 09:56 PM
"identifier> expected"error simmy_tj VB.NET 2002/2003 Basics 1 December 18th, 2006 08:31 AM
"Identifier expected" Error NehaJani VB.NET 2002/2003 Basics 6 January 23rd, 2006 11:27 PM
Error handle - stop exec. of parent function crisan Access 2 September 27th, 2005 01:55 AM
php _get and undeclared variables wolferd1 Beginning PHP 10 January 23rd, 2005 10:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.