0

dear friends,
I am using MS access as back end and vb.net as front end.
in one of my table i have a auto increment field.(for ex:orderid).
Please tell me how can i insert new row to the table with auto increment field.


Thanking you,

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by mrnileshagrawal
0

select the last OrderId value then + 1.
ex : 1,2,3
Select last value = 3, then 3 + 1 = 4...

0

dear friends,
I am using MS access as back end and vb.net as front end.
in one of my table i have a auto increment field.(for ex:orderid).
Please tell me how can i insert new row to the table with auto increment field.


Thanking you,

Hi friend ..
just imagin ur table orderid is ur column name ok so just write follwoing code.

public sub Form_Load()

Dim cmd as new OledbCommand("Select * from TableName",cn) 'cn is Connection Object

cn.open()

Dim dr as oledbdatareader=cmd.executereader

while dr.read()
TextBox1.Text=dr(0)
End While

TextBox1.Text=Val(TextBox1.Text) + 1
dr.close()
cn.close()

End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.