none
How to call STORED PROCEDURE with OUTPUT parameter in C# LYNQ ? RRS feed

  • Question

  • Hi,

    I have to call stored procedure with its Output parameter in C# LYNQ. I am having MVC application and also using LINQ to SQL in that.

    Is there anyone who should have such approach then please suggest ?

    Thanks.

    Wednesday, September 25, 2013 12:23 PM

Answers

  • You could use a SQLDataAdapter to load a DataTable and then use Linq on the DataTable. 

                DataTable mytable = new DataTable();
                Dictionary<string, List<DataRow>> dictionary = table.AsEnumerable()
                   .GroupBy(item => item.Field<string>("columnName"))
                   .ToDictionary(grp => grp.Key, grp => grp.ToList());


    jdweng

    • Marked as answer by Maggy111 Friday, October 4, 2013 10:29 AM
    Wednesday, September 25, 2013 12:56 PM
  • this is an example

    System.Data.Objects.ObjectParameter parameter = new ObjectParameter("outputParameter", "int");
    ObjectResult result = context.CheckUserStatu(User, parameter);


    Please remember to 'Mark as Answer' the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 1:10 PM

All replies

  • Wednesday, September 25, 2013 12:32 PM
  • You could use a SQLDataAdapter to load a DataTable and then use Linq on the DataTable. 

                DataTable mytable = new DataTable();
                Dictionary<string, List<DataRow>> dictionary = table.AsEnumerable()
                   .GroupBy(item => item.Field<string>("columnName"))
                   .ToDictionary(grp => grp.Key, grp => grp.ToList());


    jdweng

    • Marked as answer by Maggy111 Friday, October 4, 2013 10:29 AM
    Wednesday, September 25, 2013 12:56 PM
  • this is an example

    System.Data.Objects.ObjectParameter parameter = new ObjectParameter("outputParameter", "int");
    ObjectResult result = context.CheckUserStatu(User, parameter);


    Please remember to 'Mark as Answer' the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 25, 2013 1:10 PM