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,
select the last OrderId value then + 1.
ex : 1,2,3
Select last value = 3, then 3 + 1 = 4...
Or u can set data types as AutoNumber
it wont be a problem if your using bindingsource
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.