Auto increment proble...

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 18
Reputation: deepukng is an unknown quantity at this point 
Solved Threads: 0
deepukng deepukng is offline Offline
Newbie Poster

Auto increment proble...

 
0
  #1
May 26th, 2008
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,
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Auto increment proble...

 
0
  #2
May 26th, 2008
select the last OrderId value then + 1.
ex : 1,2,3
Select last value = 3, then 3 + 1 = 4...
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Auto increment proble...

 
0
  #3
May 26th, 2008
Or u can set data types as AutoNumber
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 3
Reputation: vasto_lordes is an unknown quantity at this point 
Solved Threads: 0
vasto_lordes vasto_lordes is offline Offline
Newbie Poster

Re: Auto increment proble...

 
0
  #4
May 27th, 2008
it wont be a problem if your using bindingsource
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 7
Reputation: mrnileshagrawal is an unknown quantity at this point 
Solved Threads: 0
mrnileshagrawal mrnileshagrawal is offline Offline
Newbie Poster

Re: Auto increment proble...

 
0
  #5
May 27th, 2008
Originally Posted by deepukng View 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,
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC