How to execute stored procedure (Visual Basic 2008)? RRS feed

  • Question

  • I am new to SQL Server and LINQ to SQL. I feel it's a cool technology, and I wanna dive deeper into it. I have database called "Bonus" and stored procedure called "msp_CreateTariffsTable". How to execute this procedure? Dim db As New BonusDataContext
    Wednesday, April 15, 2009 9:22 AM


  • Hello,

    1. Create a datacontext (.dbml) file
    2. Find your stored procedure in Server Explorer and trop it in your DataContext visual editor 
    3. Wherever you want to call the SP, instantiate your datacontext class and call the stored procedure from it as if it was a method - db.msp_CreateTariffsTable(____).

    For more details follow the MSDN documentation!

    • Proposed as answer by Lenny S Wednesday, April 15, 2009 1:05 PM
    • Marked as answer by Damien GuardModerator Wednesday, April 15, 2009 2:34 PM
    Wednesday, April 15, 2009 1:05 PM