Problem with SQLExecDirect

This is a discussion on Problem with SQLExecDirect within the Windows Programming forums, part of the Platform Specific Boards category; I've created a function which inserts into an ODBC database. The statement executes without errors, but nothing is inserted into ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Problem with SQLExecDirect

    I've created a function which inserts into an ODBC database.
    The statement executes without errors, but nothing is inserted into the database...

    Code:
    short DbConnection::Execute(char *strSql){
    	short sRes(0);
    	void *hStmt;
    
    	if(this->m_isOpen=FALSE || SQLAllocHandle(SQL_HANDLE_STMT, this->m_hDbc, &hStmt)!=SQL_SUCCESS 
    		|| SQLExecDirect(hStmt, (UCHAR*)strSql, SQL_NTS)!=SQL_SUCCESS
    		|| SQLEndTran(SQL_HANDLE_DBC, this->m_hDbc, SQL_COMMIT)!=SQL_SUCCESS){
    		this->errMsg(hStmt);
    		sRes=0;
    	}else 
    		sRes=1;
    	SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
    	return(sRes);
    }
    I tried tracing the ODBC-operarions, but it says that everything returns SQL_SUCCESS..
    Any clues?

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Figured it out, I'm an idiot, and queried the wrong DB...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21