0

I have a stored procedure for getting user details. In that there is one input parameter i.e. @UserName. Here is my stored procedure

USE [Test]
GO
/****** Object:  StoredProcedure [dbo].[GetUserByUserName]    Script Date: 6/12/2013 6:59:49 PM  ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetUserByUserName]
(
    @UserName VARCHAR(100)
)
AS
BEGIN
SET NOCOUNT ON

BEGIN TRY
    SELECT      UserID,                 
                FirstName,
                LastName,
                UserName,
                Password,
                PasswordUpdateDate,
                MembershipType,
                IsActive
    FROM        Users
    WHERE       UserName = @UserName
END TRY
BEGIN CATCH
    EXEC ThrowError
END CATCH
END

I want to execute this procedure using Linq to Sql in WCF. I want to return result in DataTable Object.

3
  • If you want a DataTable, then the ADO.NET objects would be a better choice than Linq to SQL. (example)
    – Keith
    Commented Jun 12, 2013 at 23:53
  • If I don't use DataTable, then how can I execute this stored procedure using Linq to Sql ?
    – Ajay
    Commented Jun 13, 2013 at 14:13
  • Here's an example of using Linq to SQL with stored procedures. Using this method, you'll get back objects instead of a DataTable.
    – Keith
    Commented Jun 13, 2013 at 15:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.