Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2003
    Posts
    6

    Unanswered: Executing Visual Basic file from stored procedure

    Hello,

    Does anyone know how to excute a Visual Basic file (test.bas) from within a stored procedure?

    Tnx
    Steve

  2. #2
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    hey
    can use xp_cmdshell (see BOL)
    des

  3. #3
    Join Date
    Sep 2003
    Posts
    6
    Originally posted by DesmondX
    hey
    can use xp_cmdshell (see BOL)
    des

    I tried
    EXEC master..xp_cmdshell '\\location\test.bas'

    But it returned
    '\\location\test.bas' is not recognized as an internal or external command, operable program or batch file.

  4. #4
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    get the command working in command shell (cmd), then paste that into your xp_cmdshell string...the error you get is from cmdshell not sql...

  5. #5
    Join Date
    Sep 2003
    Posts
    6
    Originally posted by DesmondX
    get the command working in command shell (cmd), then paste that into your xp_cmdshell string...the error you get is from cmdshell not sql...
    How should I do that then?

  6. #6
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    go to "run"
    type in "cmd" or "command" (depending on your OS)
    try and execute your .bas from there, that is where sql is going to execute your command

  7. #7
    Join Date
    Sep 2003
    Posts
    6
    Originally posted by DesmondX
    go to "run"
    type in "cmd" or "command" (depending on your OS)
    try and execute your .bas from there, that is where sql is going to execute your command
    I knew that, but I don't onderstand how to be able to execute the .bas file

  8. #8
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    you have to compile it...

  9. #9
    Join Date
    Sep 2003
    Posts
    6
    Originally posted by DesmondX
    you have to compile it...

    The Visual Basic file I try to use is a generated DTS package.

    Do you think this can be compiled?
    If so, what adjustments are necessary?

  10. #10
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    oh, so you want to execute a DTS package...dont think you can do that with it in .bas format - that will have to be integerated into a VB app, then compiled...rather load the DTS package onto the server then use DTSRun command to run it from xp_cmdshell...

  11. #11
    Join Date
    Sep 2003
    Posts
    6
    Originally posted by DesmondX
    oh, so you want to execute a DTS package...dont think you can do that with it in .bas format - that will have to be integerated into a VB app, then compiled...rather load the DTS package onto the server then use DTSRun command to run it from xp_cmdshell...
    Executing the DTS on the server already worked, but gave some other problems. That's why we wanted to try executing the VB file.

    At least thanks for all your help, we keep on searching...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •