Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
jhwurmbach22-Aug-07 1:19
jhwurmbach22-Aug-07 1:19 
GeneralRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
plural22-Aug-07 1:40
plural22-Aug-07 1:40 
GeneralRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
jhwurmbach22-Aug-07 1:49
jhwurmbach22-Aug-07 1:49 
AnswerRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
S Douglas22-Aug-07 2:05
professionalS Douglas22-Aug-07 2:05 
GeneralRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
jhwurmbach22-Aug-07 2:19
jhwurmbach22-Aug-07 2:19 
GeneralRe: can a visual c++ application done with VS 2005 ever exist widout .net framework Pin
JudyL_MD22-Aug-07 2:22
JudyL_MD22-Aug-07 2:22 
QuestionActiveX serialization Pin
shiraztk22-Aug-07 0:46
shiraztk22-Aug-07 0:46 
QuestionODBC & C++ Question Pin
Programm3r22-Aug-07 0:31
Programm3r22-Aug-07 0:31 
Hi all,

I am using an ODBC class written by Carlos Antollini (A set of ODBC Classes) and making use of Oracle 10g Express Edition.
Basically what I'm trying to do, is perform a select statement on the database to determine if a certain
record exists. If the record exists I perform an UPDATE stament, and when the record doesn't exists,
I perform a INSERT. (I don't want to go the route of the Stored Procedures Thanks Smile | :) )

For instance:
pdb.m_nRowsAffected=0;
pdb.Execute(SELECT * FROM TABLE WHERE FIELDNAME = 'CONDITION';);
if (pdb.m_nRowsAffected>0)
{
  UPDATE
}
else
{
  INSERT
}


THE PROBLEM:
The variable m_nRowsAffected returns a code of -1, even if the record exists. After stepping into the
function I saw that the SQLRowCount sets the variable to -1. I have no idea what is going onConfused | :confused: Confused | :confused: . If I make
use of MySQL everything works. An example of the function Execute() is shown below. Can anyone please
assist me in this problem??

BOOL CODBCDatabase::Execute(CHAR *szSqlStr)
{
	SQLRETURN ret;
	SQLHSTMT hStmt = NULL;
	SQLINTEGER nRowCount;

	SQLAllocHandle(SQL_HANDLE_STMT, m_hDbc, &hStmt);
	ret = SQLExecDirect(hStmt, (SQLCHAR*)szSqlStr, SQL_NTS);
	
	SQLRowCount(hStmt, &nRowCount);
	
	m_nRowsAffected = nRowCount;
	return ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO;
}	


Many Thanks
Regards,


The only programmers that are better that C programmers are those who code in 1's and 0's Green Alien | [Alien]

Smile | :) Programm3r

My Blog: ^_^

GeneralRe: ODBC & C++ Question Pin
Matthew Faithfull22-Aug-07 1:19
Matthew Faithfull22-Aug-07 1:19 
AnswerRe: ODBC & C++ Question Pin
James R. Twine22-Aug-07 1:53
James R. Twine22-Aug-07 1:53 
GeneralRe: ODBC & C++ Question Pin
Programm3r23-Aug-07 1:38
Programm3r23-Aug-07 1:38 
Questionhelp Pin
SnaKeBeD22-Aug-07 0:02
SnaKeBeD22-Aug-07 0:02 
AnswerRe: help Pin
Roger Allen22-Aug-07 0:29
Roger Allen22-Aug-07 0:29 
AnswerRe: help Pin
SnaKeBeD22-Aug-07 1:30
SnaKeBeD22-Aug-07 1:30 
QuestionRe: help Pin
David Crow22-Aug-07 2:56
David Crow22-Aug-07 2:56 
GeneralRe: help Pin
Russell'22-Aug-07 3:04
Russell'22-Aug-07 3:04 
GeneralRe: help Pin
Russell'22-Aug-07 3:07
Russell'22-Aug-07 3:07 
AnswerRe: help Pin
Russell'22-Aug-07 1:47
Russell'22-Aug-07 1:47 
GeneralRe: help Pin
toxcct22-Aug-07 3:11
toxcct22-Aug-07 3:11 
GeneralRe: help Pin
Russell'22-Aug-07 3:22
Russell'22-Aug-07 3:22 
AnswerRe: help Pin
PJ Arends22-Aug-07 6:28
professionalPJ Arends22-Aug-07 6:28 
QuestionOLE Drag and Drop not starting Pin
Roger Allen22-Aug-07 0:01
Roger Allen22-Aug-07 0:01 
AnswerRe: OLE Drag and Drop not starting Pin
Roger Allen22-Aug-07 0:24
Roger Allen22-Aug-07 0:24 
QuestionDBException [modified] Pin
sanjutvm21-Aug-07 23:55
sanjutvm21-Aug-07 23:55 
QuestionAggregating the ActiveX control Pin
ss43121-Aug-07 23:37
ss43121-Aug-07 23:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.