954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Auto increment proble...

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,

deepukng
Newbie Poster
18 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

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

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Or u can set data types as AutoNumber

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

it wont be a problem if your using bindingsource

vasto_lordes
Newbie Poster
3 posts since May 2008
Reputation Points: 10
Solved Threads: 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

mrnileshagrawal
Newbie Poster
7 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You