vb.net - Get the values of a column and use it to delete a record in database -


i have table in database have boolean field. want check value , use further deleting record in table...

dummy code this:

private sub del_machine()   dim machine_srno string  dim asql string = ("select * installation_det")  cnnoledb.open()  dim cmd oledb.oledbcommand = new oledb.oledbcommand(asql, cnnoledb)  dim dr oledb.oledbdatareader = cmd.executereader  if dr.read = true     if istft.checked=true      ----------> istft column in installation_det table      machine_srno=machine.value ------------> machine field in database      deletequery = "delete * new_table sr_no=@mach_srno"             dim cmd oledb.oledbcommand = new oledb.oledbcommand(deletequery,    cnnoledb)              cmd.parameters.addwithvalue("@mach_srno", machine_srno)             cmd.executenonquery()  end sub 

please me actual coding... think ful wit data table , data set dont know how use it.. please suggest me code... thank you..

get values datareader , use them query

if dr.read = true     dim istft = convert.toboolean(dr("istft"))     dim machine_srno = dr("machine").tostring()     if istft = true         dim deletequery = "delete * new_table sr_no=@mach_srno"         dim cmd oledb.oledbcommand = new oledb.oledbcommand(deletequery,    cnnoledb)         cmd.parameters.addwithvalue("@mach_srno", machine_srno)         cmd.executenonquery     end if end if 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -