Start New Discussion within our Software Development Community

Hello Guys,
I have a table having a column called Sr.No.
And I Wish that everytime i make an entry into that table Sr.No should be auto Incremented.

How Can I Achieve this Functionality ?


@pritaeas: Thanks for your cocern but my problem is solved..

I am using SQL Server which is embedded in VB.NET.

Modifying the property of Identity Column you can achieve this functionality.

@Rahul just Executescalar.

For example

insert_coupon_query As String = ("INSERT INTO qa_discountcoupons (status_code) VALUES (5); SELECT LAST_INSERT_ID()")
                Dim cmd_query As New SqlCommand(insert_coupon_query, objConn)
                Dim cmd_result As Integer = CInt(cmd_query.ExecuteScalar())

                textbox1.text = val(cmd_result) + 1
This question has already been answered. Start a new discussion instead.