How to enable automatic number counter.

Asked By 30 points N/A Posted on -
qa-featured

Hi all experts,

I am designing a program of telephone directory in C++, which will have database of all personal information entered by users. Now I want to have automatic number counter  which will be displayed before showing final result like a waiting counter. Can anyone help me in coding for enabling a automatic number counter in my program.

SHARE
Answered By 10 points N/A #164638

How to enable automatic number counter.

qa-featured

Hello Mark Lesliez,

You can integrate with your SQL command to generate automatic numbers just use the "SELECT MAX(Field_Name) as Variable from Table_Name" and add 1 so that it will increase or the increment method. For example:

 

res = stmt->executeQuery("SELECT MAX(Notes) as noteNum FROM Tasks");
while (res->next())
{
 count = int(noteNum)  +  1;
}

I have not checked that in C++ since I don't use C++ anymore (I've used that for 4 years ago). Just use the idea I have given you. I hope that would help you.

 

Related Questions