i have a MySQL table with the following columns: employeeID, firstName, lastName, gender, salary. whenever i insert a new record for this table i want to be able to retrieve the employeeID of that record. how should i write the commands in VB.Net
I do not know much about MySQL but if you have the aggregate function MAX() you can use it to retrieve the last inserted record in a table as
SELECT MAX(employeeID) FROM Table
or you can you use a subquery as
SELECT firstName, lastName, gender, salary ... FROM Table WHERE employeeID IN/= (SELECT MAX(employeeID) FROM Table)
this will return you the data of an employee which has the max employeeID value number for example if you have 5 employees numbered as 1, 2, 3, 4 and 5 you will get the data for the employee number 5. Hope this work for you
if you do not have the MAX() function in MySQL try to google for its MySQL equivalent. You can also use the COUNT() aggreagate function if you have it or google for its equivalent as it will return you a the number of records you have as on the above example if you have 5 reords it will return you a value 5 so the result will look like it is
SELECT firstName, lastName, gender, salary ... FROM Table WHERE employeeID = 5
The differenece between MAX() and COUNT() is that MAX() will return you the maximum value inside the table not the number of records meaning that if you have unordered employeeID number say 1, 12, 25, 40 and 60 so it will return you 60 as a result, however, the COUNT() function will return you 5 as the they are 5 numbers means 5 records. I hope you got the idea and I explain it well for you
Edited 4 Years Ago by Reverend Jim: fixed formatting
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...