Hi Fellows,
Well. let me start by higlighting the problem i face.I have two columns namely PID which is the primary key and also a auto number.The second is Serial No. which is also a auto number.

The problem i face is that when i submit my form spcifying a month i want my serial no. to start from one and and end with the number of records in my Datagrid.

IF i come to the same and select a different month the PID should continue from where the last auto no. is but my serial no should start from 1 again..

Is there any option to do like this.Both PID and Serial No. are in the same table.


Thanks

Recommended Answers

All 4 Replies

You can set a trigger on Insert Button as check the month for inserting record and previous record. It both are different then reset Serial No. and then insert.

Or

Click of submit button check the month of previous record and reset the Serial No. and the execute the insert command.

Thanks man,
I just checked it out... Sql wont allow me to have two auto no's.Is there any other option in code to do this and how to reset serial no to one without deleting the data.
I am using vb.net 1.1

Fellows,
I have found another option to do this(via Code).Instead of checking the month while submitting, i have found a way to count the number of rows using the dataset property

dsEmployee.Tables(0).Rows.Count

It is returning me the number of rows in my datagrid.I will write a for loop and form an ary to start from one and increment it till the last row of datagrid...Thanks for the replies..I hope some one will use this...

Thanks and Regards

If Data is so large it will affect the performance due to For Loop

Thanks
Bye.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.