开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜