开发者

increment the value of id in windows application(net) through database

开发者 https://www.devze.com 2023-01-25 17:19 出处:网络
if i click a button the last value in idshould be incremented and displayed in the textbox in windows application(.net).

if i click a button the last value in id should be incremented and displayed in the textbox in windows application(.net).

eg..

in database there are 10 records.开发者_开发知识库.. in the column id from 1 to 10... if i click the button the value should be increment and 11 should be shown in my textbox in windows application.. please send as soon as possibe


You need to specify that the ID column in your DB is an "identity" column. Then, when you insert a new record into the table, SQL will automatically assign the new record with the previous highest value in that column incremented appropriately (you can have SQL increment by 1 or more if you wish).

David Hayden wrote up a nice little article on this very subjectlink text: http://www.davidhayden.com/blog/dave/archive/2006/02/16/2803.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号