943,923 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1478
  • VB.NET RSS
May 26th, 2008
0

Auto increment proble...

Expand Post »
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,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
deepukng is offline Offline
18 posts
since May 2008
May 26th, 2008
0

Re: Auto increment proble...

select the last OrderId value then + 1.
ex : 1,2,3
Select last value = 3, then 3 + 1 = 4...
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007
May 26th, 2008
0

Re: Auto increment proble...

Or u can set data types as AutoNumber
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007
May 27th, 2008
0

Re: Auto increment proble...

it wont be a problem if your using bindingsource
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vasto_lordes is offline Offline
3 posts
since May 2008
May 27th, 2008
0

Re: Auto increment proble...

Click to Expand / Collapse  Quote originally posted by deepukng ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrnileshagrawal is offline Offline
7 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: login verification form
Next Thread in VB.NET Forum Timeline: Connect MS Access database table to crystal report, Pls help me





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC