Jump to content

need a short vbscript to insert data in database


Recommended Posts

Hello,

is it possible to runs an short vbscript to insert or update data into an access or mysql database ? like over odbc ?

i would like to update an recordset like add a counter in the db-field each time, runs the script and insert like username or else in the database.

/kr

melniboone

Link to comment
Share on other sites


melnib00ne,

With DAO 3.6



Set dao = CreateObject("DAO.DBEngine.36")

Set db = dao.OpenDatabase("DATABASE.MDB")
Set rst = db.OpenRecordset("TABLE")

rst.AddNew
rst("FIELD") = "Data"
rst.Update

rst.Close



Set dao = CreateObject("DAO.DBEngine.36")

Set db = dao.OpenDatabase("DATABASE.MDB")
Set rst = db.OpenRecordset("SELECT FIELD1 FROM TABLE WHERE FIELD2='Criteria'")

rst.Edit
rst("FIELD1") = "Data"
rst.Update

rst.Close

B)

Edited by jdoe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...