Results 1 to 3 of 3

Thread: Execute a tsql statement from VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    1

    Execute a tsql statement from VB6

    Hi,

    I am a .net developer.I would like to know the code to execute an sql statement which looks like exec msdb.dbo.sp_start_job @job_name = 'test' from vb6.

    Thanks,
    Adityaraj.

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Execute a tsql statement from VB6

    Hi aditya... Welcome to the forums...

    Check this tutorial: http://www.vbforums.com/showthread.php?t=381391

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Execute a tsql statement from VB6

    Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)

    I would actually recommend the "ADO Tutorial" from the "Classic VB" section of our Database Development FAQs/Tutorials (at the top of this forum).

    All you need for this is the Connection object, and then you can use code like this:
    Code:
    cn.Execute "exec msdb.dbo.sp_start_job @job_name = 'test'"
    However, it would also be apt (and better for various reasons) to use a Command object to run it, and there is another FAQ article which covers that.

Posting Permissions

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



Click Here to Expand Forum to Full Width