Page 1 of 1 1
Topic Options
#141903 - 2005-06-16 09:36 PM Opening RecordSet fails with WKIX32
kepaha Offline
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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#141905 - 2005-06-16 10:08 PM Re: Opening RecordSet fails with WKIX32
kepaha Offline
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
#141906 - 2005-06-17 04:47 PM Re: Opening RecordSet fails with WKIX32
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I have trouble believing it works with kix32.exe and not with wkix32.exe. Are you trying both from the same machine? If so, are you sure that it IS working with kix32.exe?

And what OS are you running it from? I've come across a that error on XP SP2 because the mdac has become corrupt - which requires a manual fix (reinstalling it doesn't appear to be allowed).

Top
#141907 - 2005-06-17 04:50 PM Re: Opening RecordSet fails with WKIX32
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Are you sure both KiX32.exe and WKiX32.exe are the same version? Have you tried a newer version?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141908 - 2005-06-17 05:45 PM Re: Opening RecordSet fails with WKIX32
kepaha Offline
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
#141909 - 2005-06-17 06:33 PM Re: Opening RecordSet fails with WKIX32
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well this is my guess

$fullname = left(@fullname, INSTRREV(@fullname, " ") - 1)


As I recall the -1 was not supported in v4.20
 

Top
#141910 - 2005-06-17 06:46 PM Re: Opening RecordSet fails with WKIX32
kepaha Offline
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
#141911 - 2005-06-17 09:21 PM Re: Opening RecordSet fails with WKIX32
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well I can only surmise then that one of the many updates from 4.20 to 4.23 is involved. If you're unable to convert or upgrade to 4.23 or the upcoming 4.5 (hopefully early next week it will be released) then you're going to have to review all the code with a fine tooth comb and change the portion that is not working in 4.20

 

Top
#141912 - 2005-06-17 09:53 PM Re: Opening RecordSet fails with WKIX32
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, not likely that Ruud will fix and re-release the 4.20 version of WKiX.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141913 - 2005-06-18 12:19 AM Re: Opening RecordSet fails with WKIX32
kepaha Offline
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
#141914 - 2005-06-19 07:00 PM Re: Opening RecordSet fails with WKIX32
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
You might also want to take a look at the UDF Forum under DBCommand() et al. before reinventing the wheel.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.061 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org