Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2008, 12:31 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

of course not i can't ignore it your suggestion , i have asked a collegue to debug it for me as i don't have visual basic on my machine , plus i have tried to use Dim xxx as New ADODB.Connection but i got a compliation error , so i did try to change it to ADODB.Connection and ADODB.RecordSet



 
Old July 24th, 2008, 12:41 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Aaarrgggh! You DON'T NEED Visual Basic because it's not Visual Basic, it's VBScript, MSXML doesn't support any compiled languages, only VBScript or JScript.

--

Joe (Microsoft MVP - XML)
 
Old July 24th, 2008, 01:00 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no offense please , am supposed to be here to find a guide from an expert like you , any way what do you want me exactly to do

 
Old July 24th, 2008, 01:08 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Sorry but it's very difficult. I gave instructions on how to isolate the code and run it in the seventh post in this topic.
Let's just check one thing, which processor are you using to run the transform? You've said MSXML but then you say you're using Visual Basic code which wouldn't work.

--

Joe (Microsoft MVP - XML)
 
Old July 24th, 2008, 01:23 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

that what i know MSXML 4.0 and 6.0 i found both in the program files
the Visual basic code i tried cause i thought it can accept visual basic but it seems as you said it is vbscript

 
Old July 24th, 2008, 01:34 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I've tidied up the code a bit and added some debugging MsgBox-es. You need to run this as a script as call the function with some realistic values.
Code:
Option Explicit

Function UpdateCOA(AccDimCode,Name,manager,closed,category,Rep1,Rep2,Rep3,Rep4,Rep5,RepLevel,AllocNum,AutoAcc,AccrualAcc,AccrualYear,AccrualPer,UsrGrp,cc,db)

    'Function to get EAN code from Stock Item and replace that stock code with the EAN

    ' Function to get EAN code from Stock Item and replace that stock code with the EAN
    Dim dsn 'As String
    Dim cn 'As ADODB.Connection
    Dim sqlStmt 'As String
    Dim recData 'As ADODB.Recordset
    Dim accountExists 'As Integer 'not sure what this is for
    Dim TmpSupplier 'As String
    dsn = "Provider=SQLOLEDB;Trusted_Connection=yes; Data Source=" &  db & "; Initial Catalog=ScaSystemDB;" &_
    " user id='user'; password='pwd'"
    set cn = CreateObject("ADODB.connection")
    cn.open dsn
    'Check if connection is open
    MsgBox cn.State, vbOkOnly, "cn 1"   
    sqlStmt = "select DBName from ScaCompanies where CompanyCode = '" & cc & "'"
    'Check sqlStmt
    MsgBox sqlStmt, vbOkOnly, "sqlStmt 1"
    Set recData = CreateObject("ADODB.Recordset") 
    recData.open sqlStmt, cn
    if not recData.EOF  then databaseName = recData(0)
    recData.close
    cn.close

    dsn = "Provider=SQLOLEDB;Trusted_Connection=yes; Data Source=" & db & "; Initial Catalog=" &_
    databaseName & "; user id='user'; password='pwd'"
    set cn = createObject("ADODB.connection")
    cn.open dsn
    'Check if connection is open  
    MsgBox cn.State, vbOkOnly, "cn 1" 
    'Check for OVT code
    accountexists = 0
    'Set recData = CreateObject("ADODB.Recordset") 
    sqlStmt = "Update  GL03" & cc & "06 Set GL03003 = '" & Name & "' , GL03006 = '" & manager & "' , GL03007 = '" & closed & "', GL03008 = '" & category &_
          "', GL03009 = '" & Rep1 & "' , GL03010 = '" & Rep2 & "', GL03011 = '" & Rep3 & "', GL03012 = '" & Rep4 & "', GL03013 = '" & Rep5 &_
         "' , GL03014 = '" & RepLevel & "', GL03015 = '" & AllocNum & "' , GL03016 = '" & AutoCc  &_
         " ', GL03017 = '" & AccrualAcc & "', GL03018 = '" & AccrualYear & "', GL03019 = '" & AccrualPer & "',GL03020 = '" & UsrGrp & "' WHERE GL03001 = '" & AccDimCode & "'"
    'Check sqlStmt
    MsgBox sqlStmt, vbOkOnly, "sqlStmt 2"
    recData.open sqlStmt, cn
    if not recData.EOF then
        if Len(recData(0)) > 0 then 
            TmpSupplier = recData(0)
        else
            TmpSupplier = supplier
        end if
    end if
    recData.Close
    cn.close
    UpdateCOA = sqlStmt 
End Function

Call UpdateCOA( <insert values here>)
Just make sure that the code lines haven't wrapped.

--

Joe (Microsoft MVP - XML)
 
Old July 24th, 2008, 03:12 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

joe ,
sorry for the delay in response i was out
please bare with me where can i run this code , do you recommend any program to download as i don't have a program to debug this code in my vbscript function is called inline inside a xslt file and the product am using will not fire this message box i guess
and thanks alot for your cooperation so far


 
Old July 24th, 2008, 03:30 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

If you save the code in a text file and call it something like "test.vbs" you can then run it by either doubble clickingon the file, or running the following from the command prompt: "cscript test.vbs"

/- Sam Judson : Wrox Technical Editor -/
 
Old July 24th, 2008, 03:36 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

joe , sorry for the delay ,

can you address a free vbscript debugger cause i don't have one on my machine, plus i don't know if the prodcut am using is going to support the msgbox as it is a vbscript function called inside the xslt document , thanks alot for you patiency and effort for supproting my problem , i do really appreciate it


 
Old July 25th, 2008, 01:26 PM
Authorized User
 
Join Date: Jul 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

At last i managed to solve the problem , first i downloaded the onscript http://www.computerperformance.co.uk...e/onscript.htm

and i removed those last three lines

Option Explicit

Function UpdateCOA(AccDimCode,Name,manager,closed,category, Rep1,Rep2,Rep3,Rep4,Rep5,RepLevel,AllocNum,AutoAcc ,AccrualAcc,AccrualYear,AccrualPer,UsrGrp,cc,db)

    'Function to get EAN code from Stock Item and replace that stock code with the EAN

    ' Function to get EAN code from Stock Item and replace that stock code with the EAN
    Dim dsn 'As String
    Dim cn 'As ADODB.Connection
    Dim sqlStmt 'As String
    Dim recData 'As ADODB.Recordset
    Dim accountExists 'As Integer 'not sure what this is for
    Dim TmpSupplier 'As String
    dsn = "Provider=SQLOLEDB;Trusted_Connection=yes; Data Source=" & db & "; Initial Catalog=ScaSystemDB;" &_
    " user id='user'; password='pwd'"
    set cn = CreateObject("ADODB.connection")
    cn.open dsn
    'Check if connection is open
    MsgBox cn.State, vbOkOnly, "cn 1"
    sqlStmt = "select DBName from ScaCompanies where CompanyCode = '" & cc & "'"
    'Check sqlStmt
    MsgBox sqlStmt, vbOkOnly, "sqlStmt 1"
    Set recData = CreateObject("ADODB.Recordset")
    recData.open sqlStmt, cn
    if not recData.EOF then databaseName = recData(0)
    recData.close
    cn.close

    dsn = "Provider=SQLOLEDB;Trusted_Connection=yes; Data Source=" & db & "; Initial Catalog=" &_
    databaseName & "; user id='user'; password='pwd'"
    set cn = createObject("ADODB.connection")
    cn.open dsn
    'Check if connection is open
    MsgBox cn.State, vbOkOnly, "cn 1"
    'Check for OVT code
    accountexists = 0
    'Set recData = CreateObject("ADODB.Recordset")
    sqlStmt = "Update GL03" & cc & "06 Set GL03003 = '" & Name & "' , GL03006 = '" & manager & "' , GL03007 = '" & closed & "', GL03008 = '" & category &_
          "', GL03009 = '" & Rep1 & "' , GL03010 = '" & Rep2 & "', GL03011 = '" & Rep3 & "', GL03012 = '" & Rep4 & "', GL03013 = '" & Rep5 &_
         "' , GL03014 = '" & RepLevel & "', GL03015 = '" & AllocNum & "' , GL03016 = '" & AutoCc &_
         " ', GL03017 = '" & AccrualAcc & "', GL03018 = '" & AccrualYear & "', GL03019 = '" & AccrualPer & "',GL03020 = '" & UsrGrp & "' WHERE GL03001 = '" & AccDimCode & "'"
    'Check sqlStmt
    MsgBox sqlStmt, vbOkOnly, "sqlStmt 2"
    recData.open sqlStmt, cn
 ' if not recData.EOF then
 ' if Len(recData(0)) > 0 then
 ' TmpSupplier = recData(0)
 ' else
 ' TmpSupplier = supplier
 ' end if
 ' end if
    recData.Close
    cn.close
    UpdateCOA = sqlStmt
End Function

Call UpdateCOA( <insert values here>)

Thanks alot for your effort and pateince Joe , Thanks sam , thanks to every one who gave me support , i do really appreciate it







Similar Threads
Thread Thread Starter Forum Replies Last Post
Operation is not allowed when the object is closed lightmaker Classic ASP Basics 1 June 6th, 2008 12:29 PM
Operation is not allowed when the object is closed kingroon Classic ASP Databases 2 February 5th, 2008 10:29 AM
OPERATION NOT ALLOWED AFTERRESULT SET IS CLOSED" picky Java Databases 0 October 4th, 2006 05:36 AM
Operation is not allowed when the object is closed kah Javascript How-To 2 February 16th, 2005 07:20 AM
operation is not allowed when object is closed shoakat Classic ASP Databases 1 November 26th, 2004 12:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.