Collecting the auto generated column value of just inserted recordIf we are using one identity column to generate auto increment numbers, then we can get the recently added number of the record just inserted by using IDENT_CURRENT function. This function will collect the auto generated number of MSSQL and display it to the visitors.In the part I we have already discussed how to create the identity field and how MSSQL automatically insert the next incremental number to each record. We will see the complete code of record insertion and getting the record number of the table generated by IDENT_CURRENT function. Here is the complete code.
Dim conn,rs,SQL,RecsAffected,dt
Each time the above code is executed one new number is inserted along with the record.
|