How to update sql table from vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • azhar rumani

    #1

    How to update sql table from vb6

    Code:
    dim rs as adodb.recordset
    dim rs=new adodb.recordset
    
    dim str as string
    
    str="select * from partymas where ac_code= ' " +    txt_party_code + " ' "
    
    if rs.state=adstateopen then
       rs.close
    end if
    
    rs.open str,gcuurrconn,adopendynamic,adlockbatchoptimistic
    
    if opt_p.value=true then
       rs.fields(orientation).value="p"
    else if opt_l.value =true then
       rs.fields(orientation).value="l"
    end if
    
    rs.batcupdate
    rs.close
    set rs=nothing
    this code is working very much fine.
    In the above code i have only mentioned rs.field(orient ation) there are other field also which i am updating similar to orientation depending on condition.

    One of my friend hinted me to use update statement
    and i am trying to use update statement and look to modify above code instead of opening a recordset.

    If anybody could help me with update statement in vb6
    Last edited by NeoPa; Nov 2 '10, 05:18 PM. Reason: Please use the [code] tags provided.
Working...