Results 1 to 2 of 2

Thread: How to add or update a stored procedure from VB.NET code?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000

    Question How to add or update a stored procedure from VB.NET code?


    I see how to alter a table just by executing that sql in VB.NET. But now I need to execute a SQL script from within VB.NET for adding a stored procedure. When I create the script for it there are several GO lines and I thought I read somewhere you cannot have all of this in to run at once. Can someone tell me how to execute this script instead of using the command line for sql to do this? I'm trying to make this easy for updating within my VB.NET windows program.



  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002

    Re: How to add or update a stored procedure from VB.NET code?

    you can still run them... you just can't read it all in to one massive string and execute it... use ReadAllLines to read the file into an array. Loop through it, adding each line to a string variable, checking for a GO as you go along... when you hit one, execute your command as you have it, clear the variable, and keep going until you hit hte end of the array (if needed, execute the last remaining command)...

    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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