HighTechTalks DotNet Forums  

Writing to Access Table

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss Writing to Access Table in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
J. J. Campbell
 
Posts: n/a

Default Writing to Access Table - 03-10-2005 , 09:51 AM






When I try to run the below simple script to add a record to an Access table,
I get an Jet db Engine error on the rst.Open line stating that it is an
invalide SQL Statment; Expected Delete, Insert, Procedure, Select or Update.

Sigh, I don't want to use an SQL statement. Can anyone please tell me what
is wrong with the below and how to fix it?

*********
<job>
<script language="VBScript">
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Const adCmdTable = 1
Dim objConn, objRst

Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=F:\My Documents\Programming\WSF
Files\SysInfo.mdb"

Set objRst = CreateObject("ADODB.Recordset")
objRst.Open "tblSysInfo", objConn, _
adOpenKeyset, adLockOptimistic, adCmdTable

objRst.AddNew
objRst("IPAddr") = "172.20.35.100"
objRst("PCName") = "MyComputer"
objRst.Update
objRst.Close
</script>
</job>

Reply With Quote
  #2  
Old   
J. J. Campbell
 
Posts: n/a

Default RE: Writing to Access Table - 03-10-2005 , 09:57 AM






Ooops, I meant to post to the WSF scripting

"J. J. Campbell" wrote:

Quote:
When I try to run the below simple script to add a record to an Access table,
I get an Jet db Engine error on the rst.Open line stating that it is an
invalide SQL Statment; Expected Delete, Insert, Procedure, Select or Update.

Sigh, I don't want to use an SQL statement. Can anyone please tell me what
is wrong with the below and how to fix it?

*********
job
script language="VBScript"
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Const adCmdTable = 1
Dim objConn, objRst

Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=F:\My Documents\Programming\WSF
Files\SysInfo.mdb"

Set objRst = CreateObject("ADODB.Recordset")
objRst.Open "tblSysInfo", objConn, _
adOpenKeyset, adLockOptimistic, adCmdTable

objRst.AddNew
objRst("IPAddr") = "172.20.35.100"
objRst("PCName") = "MyComputer"
objRst.Update
objRst.Close
/script
/job

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.