locked
Calling T-SQL from within ASP.NET Web Services RRS feed

  • Question

  • Dear all,

    Has anyone called a stored procedure (on any T-SQL code) from within ASP.NET Web Services ?

    Any usefull links to read about SQL Server 2008 and interaction with Web Services ?

    Thank you in advance.

    Best regards,

    Tom


    New to SQL Server
    • Moved by Bob Beauchemin Saturday, March 5, 2011 12:26 AM Moved to the most relevent forum available (From:.NET Framework inside SQL Server)
    Friday, March 4, 2011 4:08 PM

Answers

  • I believe you meant to ask can you run/execute a T-SQL stored proc within ASP.net web services.

    Yes you can execute a T SQL stored proc from and within asp.net web services; in terms of SQL Server data access there is no difference between calling a stored proc, inside web services/windows forms application or asp.net web application.

    i.e.  You can use same data access technologies  which is availabel for desktop application or web application  inside web services.

    e.g. ADO.net or entity framework etc.. to connect and execute a stored proc in SQL server

    see

    HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET

    http://support.microsoft.com/kb/310070/en-us

    • Edited by Chirag Shah Friday, March 4, 2011 10:24 PM update
    • Proposed as answer by Jackie-Sun Tuesday, March 8, 2011 3:35 AM
    • Marked as answer by TomS_ Tuesday, March 8, 2011 1:32 PM
    Friday, March 4, 2011 10:11 PM

All replies

  • I believe you meant to ask can you run/execute a T-SQL stored proc within ASP.net web services.

    Yes you can execute a T SQL stored proc from and within asp.net web services; in terms of SQL Server data access there is no difference between calling a stored proc, inside web services/windows forms application or asp.net web application.

    i.e.  You can use same data access technologies  which is availabel for desktop application or web application  inside web services.

    e.g. ADO.net or entity framework etc.. to connect and execute a stored proc in SQL server

    see

    HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET

    http://support.microsoft.com/kb/310070/en-us

    • Edited by Chirag Shah Friday, March 4, 2011 10:24 PM update
    • Proposed as answer by Jackie-Sun Tuesday, March 8, 2011 3:35 AM
    • Marked as answer by TomS_ Tuesday, March 8, 2011 1:32 PM
    Friday, March 4, 2011 10:11 PM
  • Here is an example how to call stored procedure from the Web client.

    http://support.microsoft.com/kb/320916

     

    There is no difference between how you do it from Windows or Web application, but there is a difference in terms of security environment, and it should be taken into consideration. In a Web environment application usually runs under specific service account (for example Network Services) and you need to make sure that this account has appropriate permissions to access SQL server and execute specific code or stored procedures.

     


    Val Mazur (MVP) http://www.xporttools.net
    • Proposed as answer by Jackie-Sun Tuesday, March 8, 2011 3:35 AM
    Monday, March 7, 2011 10:54 AM