#141903 - 2005-06-16 09:36 PM
Opening RecordSet fails with WKIX32
|
kepaha
Fresh Scripter
Registered: 2005-06-10
Posts: 9
Loc: Seattle, WA, USA
|
I have finagled the following script (beginning with a sample found online) to write records to an Access db. I then call the KiX script from a batch file. If the batch file calls "\\server\path\kix32.exe \\path\script.kix", all is well. However, I prefer to use wkix32.exe and if I replace kix32 with wkix32 in the batch file, then the KiX script fails on the "$cmd.commandtext = $CMDtxt $rs.Open ($cmd)" line. Writing to screen, the error description is "COM exception error "Open" (ADODB.Recordset - The connection cannot be used to perform this operation. It is either closed or invalid in this context.) [-2147352567/80020009]". I cannot understand why this would work with KIX32 and not with WKIX32. Any insight ??? Thanks.
;====script==== $DBpath = "c:\hdtest.mdb"
$fullname = left(@fullname, INSTRREV(@fullname, " ") - 1) $date = substr(@date, 6, 3) + substr(@date, 9, 2) + "/" + substr(@date, 1, 4) $2 = @crlf + @crlf
color n/y+ At (3,2) " To send a request to the Help Desk type a brief " At (4,2) " description of your question and then press Enter: " $2 color w/n gets $Input
If $Input = "" ?"Please enter a description of your issue before pressing Enter:" + $2 gets $Input EndIf
$Body = $input + $2 + $fullname $CNstring = "provider=microsoft.jet.oledb.4.0;data source=$DBpath;persist security info=false" $CMDtxt = "select * from TblCalls where 'CallUser' = 'Howitzer, Nanette'" $cn = CreateObject ("ADODB.Connection") $cmd = CreateObject ("ADODB.Command") $rs = CreateObject ("ADODB.RecordSet")
$cn.connectionstring = $CNstring $cn.Open $cmd.activeconnection = $cn $rs.cursortype = 3 $rs.locktype = 3 $rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt $rs.Open ($cmd)
$rs.addnew $rs.fields.item("CallUSA").value = "1" $rs.fields.item("CallCategory").value = "10" $rs.fields.item("CallDescription").value = $Body $rs.fields.item("CallDate").value = $date $rs.fields.item("CallUser").value = "10435" $rs.update $rs.Close
|
Top
|
|
|
|
#141904 - 2005-06-16 10:04 PM
Re: Opening RecordSet fails with WKIX32
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
What version of KiX are we working with?
Have you been to - http://www.connectionstrings.com/ as there are a number of ways to connect to a database?
Kent
|
Top
|
|
|
|
#141905 - 2005-06-16 10:08 PM
Re: Opening RecordSet fails with WKIX32
|
kepaha
Fresh Scripter
Registered: 2005-06-10
Posts: 9
Loc: Seattle, WA, USA
|
version 4.20. I have not been to that url, I will check it out.
|
Top
|
|
|
|
#141908 - 2005-06-17 05:45 PM
Re: Opening RecordSet fails with WKIX32
|
kepaha
Fresh Scripter
Registered: 2005-06-10
Posts: 9
Loc: Seattle, WA, USA
|
Yes, both from the same machine. I am certain it is working with kix32. I check the db and the record is added. Running on XP, sp2. MDAC corruption would cause many other problems on this PC, so I don't think that is it.
Both kix32 and wkix32 are ver. 4.20. I tried it with 4.23, and it WORKS with both kix32 and wkix32.
|
Top
|
|
|
|
#141910 - 2005-06-17 06:46 PM
Re: Opening RecordSet fails with WKIX32
|
kepaha
Fresh Scripter
Registered: 2005-06-10
Posts: 9
Loc: Seattle, WA, USA
|
I remarked out the fullname line and the line where it is added as part of the body. Still, works with kix32 and does not work with wkix32.
|
Top
|
|
|
|
#141913 - 2005-06-18 12:19 AM
Re: Opening RecordSet fails with WKIX32
|
kepaha
Fresh Scripter
Registered: 2005-06-10
Posts: 9
Loc: Seattle, WA, USA
|
Ja, methinks we'll have to go to 4.23 or higher. Thanks for your assistance.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 515 anonymous users online.
|
|
|