CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2000
    Posts
    5

    Stored procedures

    I have been writing a program with lots of sql queris and I would like to know how to write stored procedures in Visual Basic coding. I need this very very much.
    Can you please tell me how to write, where to store it and how to execute ?
    Also,I've heard that parameters can be passed to a stored procedure...
    Of course,I need to write some very complicated procedures...
    An example would be much appreciated...
    Thnx



  2. #2
    Guest

    Re: Stored procedures

    In SQL Server 6.5 you can do the following.
    To create a stored procedure go to the database you want and then goto manage stored procedures.
    create a procedure like the following
    CREATE PROCEDURE sp_mytableSelect @id numeric(10,0)AS
    select * from mytable where id=@id

    Then when you want to call it from vb do it the same way as you would do any SQL statement and pass the id parameter to it.
    ie

    SqlStr = "sp_mytableSelect " & RequiredId
    set ars=cnn.execute(SqlStr)



    this will run the stored procedure and return any value received into the recordset.
    This is simplistic but I hope it gives you a start.


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

Featured