1 Replies - 3142 Views - Last Post: 03 October 2012 - 05:26 AM Rate Topic: -----

#1 tingu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 24-September 12

Auto id generation

Posted 03 October 2012 - 12:41 AM

I want to create a unique customer id in vb.net& sqlserver database
when a save button is clicked i want to insert customer details along with a cust id
inserting code is working
The problem is I, cant crete a cust id of this formatFor Eg.year/name-000001 & so on.....
kindly reply for this auto id creation for each customer entry

thanks in advance
Is This A Good Question/Topic? 0
  • +

Replies To: Auto id generation

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: Auto id generation

Posted 03 October 2012 - 05:26 AM

If the ID is unique, then there is really no reason that the ID should contain the name also.

In other words

ID       CustName
1        Widgits, Inc.
2        Wonka Chocolates


ID would be an autoincrement field

To display this information on your forms you would format it by using the values of the two

CustomerAccountNumber = reader("CustName").ToString & "-" & Cint(reader("ID").ToString("000000")


CustomerAccountNumber would now hold Widgits, Inc-000001
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1