logo
down
shadow

Unable to retrieve column values from one of the tables joined in a stored procedure?


Unable to retrieve column values from one of the tables joined in a stored procedure?

Content Index :

Unable to retrieve column values from one of the tables joined in a stored procedure?
Tag : chash , By : damomurf
Date : December 01 2020, 05:00 PM

around this issue I have stored procedures(it work fine in sql) which can return data from two tables as below: , update your code
public List<GroupUserList> GetData()
    {

        DataTable dt = new DataTable();
        List<GroupUserList> details = new List<GroupUserList>();
        using (SqlConnection con = new SqlConnection(Global.Config.ConnStr))
        {
            SqlCommand cmd = new SqlCommand("spp_adm_user_user_group_sel", con);
            cmd.CommandType = CommandType.StoredProcedure;


            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            foreach(DataRow dr in dt.Rows)
            {
                GroupUserList usr = new GroupUserList();

                usr.name = dr["Group_Name"].ToString();
                usr.fullname = dr["fullname"].ToString();
                usr.designation = dr["designation"].ToString();
                usr.mobile = dr["mobile"].ToString();
                usr.email = dr["email"].ToString();

                details.Add(usr);
            }


            return details;
        }

    }

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Can Entity Framework deal with multiple result sets (each from joined tables) from a stored procedure?


Tag : development , By : Ganesh
Date : March 29 2020, 07:55 AM
this will help This isn't supported out of the box in the new EF.
But there is a project on CodeGallery called EF Extensions that shows how to do this easily enough.

can we retrieve a column present in one stored procedure into another stored procedure in mysql


Tag : mysql , By : Juan Pablo
Date : March 29 2020, 07:55 AM

Retrieve list/rows of values from "select" stored procedure , where stored procedure Function is auto generate


Tag : asp.net-mvc , By : platformNomad
Date : March 29 2020, 07:55 AM
I wish this help you How to retrieve list/rows of values from "select" stored procedure Function , where stored procedure Function is auto generated from Entity Framework , i got the solution and its working
Changed stored procedure
create procedure [dbo].[SP_MobileList]
As
Begin
select MobileId,MobileName from BasicMobileData
END
 public virtual ObjectResult<SP_MobileIdName_s_Result> SP_MobileIdName_s()
{
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SP_MobileIdName_s_Result>("SP_MobileIdName_s");
}

public partial class SP_MobileIdName_s_Result
{
   public string MobileId { get; set; }
   public string MobileName { get; set; }
}
public class MobileController : Controller
    {
        MobileEntities objMobileContext = new MobileEntities();
        SP_MobileIdName_s_Result objMobile = new SP_MobileIdName_s_Result();

        #region "ActionMethods"
        public ActionResult MobileDetails()
        {
            foreach (SP_MobileIdName_s_Result objMobile in objMobileContext.SP_MobileIdName_s())
            {
                Response.Write(objMobile.MobileId);
                Response.Write(objMobile.MobileName);
            }
            return View();
        }
        #endregion

    }

Unable to insert null values in nullable column via stored procedure in C#


Tag : chash , By : scott.sizemore
Date : March 29 2020, 07:55 AM
wish help you to fix your issue You've pretty much answered your own question null and DBNull.Value are different things. Where DBNull.Value means something to the database provider than null doesn't.
From MSDN on DBNull:

Insert Data Into three joined tables using a stored procedure


Tag : sql , By : Brian Cupps
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Anyone know a good workaround for the lack of an enum generic constraint?
  • Is the C# static constructor thread safe?
  • What is the difference between String and string in C#?
  • Multicore Text File Parsing
  • Invalid Resource File
  • Getting DirectoryNotFoundException when trying to Connect to Device with CoreCon API
  • How to wait for thread complete before continuing?
  • Is String.Format as efficient as StringBuilder
  • ASP.NET Web Service Results, Proxy Classes and Type Conversion
  • sgen.exe fails during build
  • In C#, why can't a List<string> object be stored in a List<object> variable
  • C# loop - break vs. continue
  • How to access .Net element on Master page from a Content page?
  • Why are unsigned int's not CLS compliant?
  • Why is Array.Length an int, and not an uint
  • How do I make event callbacks into my win forms thread safe?
  • Genealogy Tree Control
  • WCF Service - Backward compatibility issue
  • Binary patch-generation in C#
  • Tab Escape Character?
  • When do Request.Params and Request.Form differ?
  • The imported project "C:\Microsoft.CSharp.targets" was not found
  • Numeric Data Entry in WPF
  • Print a Winform/visual element
  • C# logic order and compiler behavior
  • When to use an extension method with lambda over LINQtoObjects to filter a collection?
  • How to make a button appear as if it is pressed?
  • C# and Arrow Keys
  • How do you resolve a domain name to an IP address with .NET/C#?
  • Should the folders in a solution match the namespace?
  • How can I evaluate C# code dynamically?
  • CSharpCodeProvider Compilation Performance
  • How can I create Prototype Methods (like JavaScript) in C#.Net?
  • DataTable Loop Performance Comparison
  • CSV string handling
  • What is the best way to do unit testing for ASP.NET 2.0 web pages?
  • High availability
  • What to use for Messaging with C#
  • Accessing a Dictionary.Keys Key through a numeric index
  • ConfigurationManager.AppSettings Performance Concerns
  • What Are Some Good .NET Profilers?
  • Is this a good way to determine OS Architecture?
  • How to create a tree-view preferences dialog type of interface in C#?
  • Searching directories for tons of files?
  • Can I have a method returning IEnumerator<T> and use it in a foreach loop?
  • Why can't I have abstract static methods in C#?
  • Displaying ad content from Respose.WriteFile()/ Response.ContentType
  • Convert integers to written numbers
  • Absolute path back to web-relative path
  • How can we generate getters and setters in Visual Studio?
  • Bringing Window to the Front in C# using Win32 API
  • Possible to "spin off" several GUI threads? (Not halting the system at Application.Run)
  • Reading a C/C++ data structure in C# from a byte array
  • How should I translate from screen space coordinates to image space coordinates in a WinForms PictureBox?
  • Setting Objects to Null/Nothing after use in .NET
  • Converting ARBG to RGB with alpha blending
  • Is it better to create Model classes or stick with generic database utility class?
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com