vbscript - lesen, schreiben oder updaten einer Access Datei
Artikel bewerten
(11)
how to read and write an Access Database in vbscript includes an update function: if the Entry exists Records are updated if not a new entry is generated
read
reads an table of an Access Database you have to fill in the right Field names: rs.Fields("Spalte1")
Set conn = CreateObject("ADODB.Connection")
' Connect to the database
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.mdb"
conn.Open strConnect
StrSQL = "Select * from daten"
Set rs = conn.Execute(StrSQL)
Do While not rs.EOF
wscript.echo "Spalte1:" & rs.Fields("Spalte1") & " Spalte2:"& rs.Fields("Spalte2")
rs.MoveNext
Loop
Update or add new
the sub function updateornew searches Row1 for an existing Variable:
if exists the entry is updated if not it will make a new entry in the database
the function addnewentry always makes a new entry in the database
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'Main Program
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'call addnewentry("Row1entry","Row2entry","Row3entry")
call updateornew("Row1 new or update eintry","Row2","Row3")
'''''''''''''''''''''''''''''''''''''''''''''''''''''
--------------------------- VbsEdit --------------------------- Line: 24 Column: 0 Error: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. Code: 800A0CB3 Source: ADODB.Recordset
System: Initialization failed because of an invalid line in the
configuration file %1. The invalid line is the data.
Webmaster: welches Betriebssytem ? / Office Version ? ist die Benutzerkontensteuerung aktiv?
(Nr:1) Fritz schrieb am 15.01.2010 08:01
Adding new db throws an exeption instead of creating a new db Microsoft JET Database Engine: Datei 'c:\test.mdb' not found
(Windows XP SP3, WSH 5.6)
Kommentare die nicht unmittelbar mit diesem Thema zu tun haben,
sowie Supportanfragen oder Hilfe bitte ins Forum posten: Support Forum