Insert/Update records in SQL server through VB code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • venkatanarasimhaa
    New Member
    • Dec 2007
    • 20

    Insert/Update records in SQL server through VB code

    Hi,

    I am very basic SQL user. I have a table in SQL server called "Employee"

    Now I would like to insert a record into the same using VB 6.0 coding.
    1) I need to enter :

    Employee_Name = 'Venkat'
    Employee_No = 1
    Employee_Salary = 10000

    2) At the same time, I need to update the same table with
    Employee_Salary = 20000

    Could you please let me know the VB coding to insert/update the record into SQL server.

    Thanks in advance.

    Waiting for your reply.


    Warm Regards,

    Venkat.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try using this

    [code=vb]
    con.BeginTrans 'con is the ADODB connection object.
    con.execute "your sql statment"
    con.CommitTrans
    [/code]

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Have you Opened a Connection Object and a Recordset ....?

      Regards
      Veena

      Comment

      Working...