|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
version 4.20. I have not been to that url, I will check it out. |
||||||||
|
|
|||||||
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). |
||||||||
|
|
|||||||
Are you sure both KiX32.exe and WKiX32.exe are the same version? Have you tried a newer version? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
Well this is my guess $fullname = left(@fullname, INSTRREV(@fullname, " ") - 1) As I recall the -1 was not supported in v4.20 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Ja, not likely that Ruud will fix and re-release the 4.20 version of WKiX. |
||||||||
|
|
|||||||
Ja, methinks we'll have to go to 4.23 or higher. Thanks for your assistance. |
||||||||
|
|
|||||||
You might also want to take a look at the UDF Forum under DBCommand() et al. before reinventing the wheel. |