vb.net - Code to track the no of data already entered -


i have form want enter sr. nos machines.it have combo box have choose invoice no saved in table along corresponding qty of machines. when entering machine details should me "enter sr no. x'th/y'th machine y total qty saved in db , x no. of sr no. have saved+1 "

it should allow me save no. where.. mean in variable if pause work in between , after word if continue should me "enter detail x'th/y'th" not "1'st/y'th"

i using code:

private sub get_qty()      dim qtysql string = "select * invoice1 chalan_no='" & cmbchal_no.text & "'"     cnnoledb.open()     dim cmd oledb.oledbcommand = new oledb.oledbcommand(qtysql, cnnoledb)      dim dr oledb.oledbdatareader = cmd.executereader      if dr.read = true         qnty = dr("qty")     end if      cnnoledb.close()  end sub  private sub srno_enter()      dim nosql string = "select count(sr_no) vendor_machine group by(chalan_no) having chalan_no='" & cmbchal_no.text & "'"     cnnoledb.open()     dim cmd oledb.oledbcommand = new oledb.oledbcommand(nosql, cnnoledb)         ' suggest code retrieve count(sr_no)           <--------------------------      cnnoledb.close()  end sub  private sub show()      lblmachine= 'result of count(sr_no)' "/" qnty end sub 

please suggest me code same.. thank you..

just use identity column in database , let database engine work of creating next free number.

if wrote stored procedure insert, return serial number output parameter


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -