Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


ODBC - SQLAllocHandle

This topic is 5665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi How should I use ODBC when fetching data. Should i allocstatment for every select and close it between. Isent that time consueming? Isent there a better way?
retval = SQLAllocHandle(SQL_HANDLE_STMT,conn,&stat);
if((retval != SQL_SUCCESS) && (retval != SQL_SUCCESS_WITH_INFO) )
	Error("SQLAllocHandle SQL_HANDLE_STMT",retval);
	return false;
sprintf(sql,"select * from player where name =''%s''",szlParam);
retval = SQLExecDirect(stat,(unsigned char *)sql,strlen(sql));
if((retval != SQL_SUCCESS) && (retval != SQL_SUCCESS_WITH_INFO) )
	return false;
cPlayer *Player = (cPlayer * )uiParam;
SQLBindCol(stat, 1, SQL_C_ULONG, &Player->ulPlayer_ID, 0,0);
SQLBindCol(stat, 2, SQL_C_CHAR, Player->szPlayerName, sizeof(Player->szPlayerName), 0);
SQLBindCol(stat, 3, SQL_C_CHAR, Player->szPassword, sizeof(Player->szPassword), 0);
if((retval != SQL_SUCCESS) && (retval != SQL_SUCCESS_WITH_INFO) )
	return false;
retval =  SQLFetch(stat);
return  retval != SQL_NO_DATA;
Should i use SQLCloseCursor or SQLFreehandle

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!