Creating stored procs with VB.NET


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Creating stored procs with VB.NET

  1. #1
    Join Date
    Mar 2005
    Posts
    53

    Creating stored procs with VB.NET

    I have to create databases and stored procs based on a user's prompt through a web page.

    Is there a way to create a stored proc within VB.NET?

    Thanks,
    Ninel

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2005
    Posts
    53
    I need to create a stored procedure that has quite a few statements.
    Code:
    CREATE PROCEDURE usp_PoliticalProcessing 
    AS
    
    UPDATE dbo.list_staging 
    SET sPhone = RTrim(LTrim(Convert(varchar(30), Convert(numeric(20, 1), phone))))
    
    UPDATE dbo.list_staging 
    SET sPhone = Substring(sphone, 1, patindex('%.%', sphone)-1)
    
    UPDATE  dbo.list_staging 
    SET  sphone =  replace(replace(replace(replace(replace(replace(sphone,'.',''),',',''  ),'-',''), ' ',''), '(', ''), ')', '')
    
    ALTER TABLE  dbo.list_staging  ADD [iList_StagingID] INT IDENTITY(1,1)
    
    ALTER TABLE  dbo.list_staging  ADD [sFailedValidation] char(1)
    
    Update dbo.list_staging
    SET sFailedValidation = 'X' 
    WHERE(Len(RTrim(LTrim(sPhone))) <> 10)"
    
    UPDATE a "
    SET a.sFailedValidation = 'X' "
    FROM  dbo.list_staging a "
    INNER JOIN   dbo.list_staging b "
    ON a.sPhone= b.sPhone "
    WHERE(a.iList_StagingID > b.iList_StagingID)
    I did some research and found that SQL Server doesn't allow statements to be combined in one batch. (You can combine them when using the GO keyword and executing from SQL Query Analyzer or another tool, but not from within code.)

    Having said all that, how can I create this proc from within VB.NET?

    Is this even possible?

    Thanks,
    Ninel

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Finding Differences in Stored Procs
    By Tim in forum Database
    Replies: 3
    Last Post: 10-25-2001, 04:43 AM
  2. A moderate view.
    By Paul Mc in forum .NET
    Replies: 214
    Last Post: 06-01-2001, 08:27 AM
  3. Debugging Stored Procs .....
    By Harsha in forum VB Classic
    Replies: 0
    Last Post: 02-19-2001, 01:16 PM
  4. Data Environment stored procs
    By wrk in forum VB Classic
    Replies: 0
    Last Post: 09-26-2000, 03:31 PM
  5. VB6 DataEnvironment Command Obj and Stored Procs
    By Mister_Frosty in forum VB Classic
    Replies: 0
    Last Post: 08-01-2000, 04:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center