ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Using Stored Procedure with Entity Framework in Linq query in ASP.Net<p>hi,</p> <p>I am trying to pass parameter to sp in an MVC controller.</p> <p>The stored procedure has a parameter that return a table from a string like 's1,s2,s3' (i have a Split Function in database).</p> <p>In Sql works fine but in my project i get model with no entities</p> <p>when i select the checkboxes that represent the multifilter i have no result</p> <p>I create a comma separated string when user checks the checkboxes that represent the product lines and then i use that string as parameter in stored procedure.</p> <p>i have a sp that works like</p> <pre class="brush: sql">select * from tab where produtLine In (select value from dbo.Split(COALESCE(@Linea,&#34;xxxx&#34;, &#34;,&#34;)...etc</pre> <p>the code in c# works but when i try to pass as Line Line1,Line2..etc I recive no result</p> <p>the code</p> <pre class="brush: csharp"> public ActionResult Index(String cliente, int ? anno, String [] linea, String tipoDati ) { String Codage = &#34;000&#34;; tipoDati = &#34;Ordini&#34;; string lineeSelezionate = null; cliente = cliente == &#34;cliente&#34; ? null : cliente; if (linea != null) { foreach (var item in linea) { lineeSelezionate += item + &#34;,&#34;; } lineeSelezionate = &#34;&#39;&#34; + lineeSelezionate.Substring(0, lineeSelezionate.Length - 1) + &#34;&#39;&#34;; } IEnumerable&lt;OrdineMeseLineaView&gt; model; if (string.IsNullOrEmpty(cliente) &amp;&amp; anno == null &amp;&amp; linea == null) { model = new List&lt;OrdineMeseLineaView&gt; { new OrdineMeseLineaView { Linea = &#34;&#34;, Gen = 0, Feb = 0, Mar = 0, Apr = 0, Mag = 0, Giu = 0, Lug = 0, Ago = 0, Set = 0, Ott = 0, Nov = 0, Dic = 0,Tot=0} }; } else { model = db.Database. SqlQuery&lt;OrdineMeseLineaView&gt;(&#34;dbo.PivotOrdiniMeseLineaSp @p0, @p1,@p2, @p3&#34;, Codage, (object)cliente ?? DBNull.Value, (object)anno ?? DBNull.Value, (object)lineeSelezionate ?? DBNull.Value).ToList(); } return View(model); }</pre>http://www.aspforums.net/Threads/176712/Using-Stored-Procedure-with-Entity-Framework-in-Linq-query-in-ASPNet/http://www.aspforums.net/Threads/176712/Using-Stored-Procedure-with-Entity-Framework-in-Linq-query-in-ASPNet/Mon, 13 Nov 2017 06:44:51 GMTUsing reflection to loop through related tables in entity object in ASP.Net<p>Hi there&nbsp;</p> <p>&nbsp;</p> <p>I need some help how do i&nbsp;using reflection to loop through related tables in entity object. so that i can find if and entitiy object is been used in any of the other tables</p>http://www.aspforums.net/Threads/122641/Using-reflection-to-loop-through-related-tables-in-entity-object-in-ASPNet/http://www.aspforums.net/Threads/122641/Using-reflection-to-loop-through-related-tables-in-entity-object-in-ASPNet/Fri, 24 Jun 2016 02:25:03 GMTPopulate Windows Forms ComboBox control using Entity Framework<p>HI,<br /> &nbsp;<br /> I tried to show list of name on cmbobox<br /> &nbsp;<br /> <br /> this is the code(query<br /> var query = (from p in dbhome.Stores select new { p.FNameware,p.id }).ToList();<br /> Cbox.DataSource = query.ToList();</p>http://www.aspforums.net/Threads/135727/Populate-Windows-Forms-ComboBox-control-using-Entity-Framework/http://www.aspforums.net/Threads/135727/Populate-Windows-Forms-ComboBox-control-using-Entity-Framework/Sat, 09 Mar 2013 07:21:53 GMTI want to create Registration with login form in MVC 4 razor using Entity framework<p>Please send me the solution</p>http://www.aspforums.net/Threads/117175/I-want-to-create-Registration-with-login-form-in-MVC-4-razor-using-Entity-framework/http://www.aspforums.net/Threads/117175/I-want-to-create-Registration-with-login-form-in-MVC-4-razor-using-Entity-framework/Wed, 01 Jun 2016 12:46:57 GMTHow to use Entity Framework with SQL Server 2000<p>Is it possible to use sql server 2000 with entity framework 6.</p> <p>if it is possible then please give me way for it.</p> <p>&nbsp;</p> <p>thanks</p> <p>Pragnesh P Raval</p>http://www.aspforums.net/Threads/296232/How-to-use-Entity-Framework-with-SQL-Server-2000/http://www.aspforums.net/Threads/296232/How-to-use-Entity-Framework-with-SQL-Server-2000/Fri, 17 Oct 2014 05:44:15 GMTHow to use Entity Framework in ASP.Net Web Application<p>How to Use Entity Frame work in my web applicaltion</p>http://www.aspforums.net/Threads/196325/How-to-use-Entity-Framework-in-ASPNet-Web-Application/http://www.aspforums.net/Threads/196325/How-to-use-Entity-Framework-in-ASPNet-Web-Application/Sat, 04 May 2013 00:15:43 GMTUsing Group By clause with Entity Framework in C# .Net<p>i have a scenario where i have to display the state name and number of cities in that state in autocompletet text how to do that</p> <p>&nbsp;</p> <pre class="brush: csharp">[HttpPost] public JsonResult find(string Text) { var suggestedUsers = (from x in lw.RWW_CountriesMaster where x.Country.StartsWith(Text) select new { country = x.Country, capital = x.Capital }).Distinct(); var count = (from x in lw.RWW_CountriesMaster where x.Country.StartsWith(Text) select new { country = x.Country, capital = x.Capital }).Count(); var result = suggestedUsers.Take(5).ToList(); //return result; return Json(result, JsonRequestBehavior.AllowGet); }</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/106022/Using-Group-By-clause-with-Entity-Framework-in-C-Net/http://www.aspforums.net/Threads/106022/Using-Group-By-clause-with-Entity-Framework-in-C-Net/Wed, 17 Sep 2014 02:36:28 GMTUse Stored Procedure with Entity Framework in ASP.Net<p>hi</p> <p>how witre procuder or function in Entity framwork.</p> <p>please attend&nbsp; me i want create or write in Designing&nbsp; ef</p> <p>i dont want add from db sql</p> <p>&nbsp;</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/106181/Use-Stored-Procedure-with-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/106181/Use-Stored-Procedure-with-Entity-Framework-in-ASPNet/Wed, 13 Mar 2013 00:34:27 GMTUse Output Parameter with Entity Framework (Edmx) in C# .Net<p>I have develop a function to add textbox value into data base my function work perfectly .now I am using that table primary key into another table where it declare as a foreign key now i required to return my Id as a output parameter in table1 &nbsp;means( set scope identity) &nbsp;&nbsp;&nbsp;so that I used this Id into another table as a foreign key please help me how I used this scope identity into a web method</p> <pre class="brush: js">function Insertdata() { var name = $(&#39;#txtfname&#39;).val(); $.ajax({ type: &#39;POST&#39;, url: &#34;Insert.aspx/DataInsertion&#34;, contentType: &#34;application/json; charset=utf-8&#34;, data: &#39;{name:&#34;&#39; + name + &#39;&#34;, Id:&#34;&#39; + output + &#39;&#34;}&#39;, async: false, success: function (response) { alert(&#34; Saving the Data.!&#34;); }, error: function () { alert(&#34;Some Error occured While Saving the Data.!&#34;); } }); }; </pre> <p>&nbsp;</p> <pre class="brush: csharp">Web method [WebMethod] public static string DataInsertion(string name Id output) { using (var db = new MyEntities())///////this is edmx name { db.Insertion( Name=name, Id=Output ); } return &#34; Data Successfully Saved&#34;; } </pre> <p>I read a lot of article but I have no idea to use it.</p> <p>Please help me&nbsp;</p>http://www.aspforums.net/Threads/787562/Use-Output-Parameter-with-Entity-Framework-Edmx-in-C-Net/http://www.aspforums.net/Threads/787562/Use-Output-Parameter-with-Entity-Framework-Edmx-in-C-Net/Fri, 07 Aug 2015 09:26:31 GMTSystem.Data.SqlClient.SqlException: Invalid object name 'Phase1'<p>Hi....,</p> <p>I got an error of&nbsp;System.Data.SqlClient.SqlException: Invalid object name 'Phase1'like this but in my code there is no Phase1..what should i do..plz help me...</p>http://www.aspforums.net/Threads/164268/SystemDataSqlClientSqlException-Invalid-object-name-Phase1/http://www.aspforums.net/Threads/164268/SystemDataSqlClientSqlException-Invalid-object-name-Phase1/Tue, 16 Sep 2014 10:04:10 GMTSum of DataTable columns total using Lambda Expression in Entity FrameWork in ASP.Net<pre><font color="red"> decimal total = dt.AsEnumerable().Sum(row =&gt; row.Field&lt;decimal&gt;("TotalAmount"));<br /><br /><br /><br />when i try to add the total amount from grid view row then i'm faicing above error sir</font></pre>http://www.aspforums.net/Threads/861050/Sum-of-DataTable-columns-total-using-Lambda-Expression-in-Entity-FrameWork-in-ASPNet/http://www.aspforums.net/Threads/861050/Sum-of-DataTable-columns-total-using-Lambda-Expression-in-Entity-FrameWork-in-ASPNet/Mon, 19 Dec 2016 05:15:01 GMTPM EntityFramework -Version 6.0.0-alpha1 -Pre The term EntityFramework is no<p>hi when install EntityFramework -Version 6.0.0-alpha1 -Pre in asp.net</p> <p>&nbsp;</p> <p>i see this error</p> <p>PM&gt; EntityFramework -Version 6.0.0-alpha1 -Pre <br />The term 'EntityFramework' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify<br />&nbsp;that the path is correct and try again.<br />At line:1 char:16<br />+ EntityFramework &lt;&lt;&lt;&lt;&nbsp; -Version 6.0.0-alpha1 -Pre <br />&nbsp;&nbsp;&nbsp; + CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ObjectNotFound: (EntityFramework:String) [], CommandNotFoundException<br />&nbsp;&nbsp;&nbsp; + FullyQualifiedErrorId : CommandNotFoundException</p> <p>&nbsp;</p> <p>whats problem for me?<br />&nbsp;</p>http://www.aspforums.net/Threads/206189/PM-EntityFramework--Version-600-alpha1--Pre-The-term-EntityFramework-is-no/http://www.aspforums.net/Threads/206189/PM-EntityFramework--Version-600-alpha1--Pre-The-term-EntityFramework-is-no/Fri, 29 Mar 2013 08:48:39 GMTObject Name dbo.Poste invalid. or Object Name dbo.User invalid in Entity Framework<p>I am developing an ASP .Net MVC 3 application using C# and SQL Server 2005.</p> <p>I've created 2 models (User &amp; Poste) with their controllers (UserController &amp; PosteController) thanks to the method of creation with 'Read/Write actions and views, using Entity Framework'.</p> <p>When i would like to access to the view of User or Poste, that's mean when I put /Poste (or /User) in my URL to access to the index, this error appears to me :</p> <p>&nbsp;</p> <pre class="brush: xml">Object Name &#39;dbo.Poste&#39; invalid. or Object Name &#39;dbo.User&#39; invalid.</pre> <p><span>This is the model of User :</span></p> <p><span><br /></span></p> <pre class="brush: csharp">using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Globalization; using System.Web.Mvc; using System.Web.Security; using System.Data.SqlClient; using System.Data.Entity; namespace MvcApplication2.Models { public class User { [Required] [Key] [Display(Name = &#34;Matricule :&#34;)] public string Matricule { get; set; } [Required] [Display(Name = &#34;Nom :&#34;)] public string Nom_User { get; set; } [Required] [StringLength(100, ErrorMessage = &#34;Le {0} doit avoir au minimum {2} caract&egrave;res.&#34;, MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = &#34;Mot de passe :&#34;)] public string passWord { get; set; } [Required] [Display(Name = &#34;Type :&#34;)] public string Type_User { get; set; } [Required] [Display(Name = &#34;ID_UF :&#34;)] public string ID_UF { get; set; } } }</pre> <p>this is the Controller of User :</p> <div>&nbsp;</div> <pre class="brush: csharp">using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Mvc; using MvcApplication2.Models; namespace MvcApplication2.Controllers { public class UserController : Controller { private GammeContext db = new GammeContext(); // // GET: /User/ public ViewResult Index() { return View(db.Users.ToList()); } // // GET: /User/Details/5 public ViewResult Details(string id) { User user = db.Users.Find(id); return View(user); } // // GET: /User/Create public ActionResult Create() { return View(); } // // POST: /User/Create [HttpPost] public ActionResult Create(User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return RedirectToAction(&#34;Index&#34;); } return View(user); } // // GET: /User/Edit/5 public ActionResult Edit(string id) { User user = db.Users.Find(id); return View(user); } // // POST: /User/Edit/5 [HttpPost] public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction(&#34;Index&#34;); } return View(user); } // // GET: /User/Delete/5 public ActionResult Delete(string id) { User user = db.Users.Find(id); return View(user); } // // POST: /User/Delete/5 [HttpPost, ActionName(&#34;Delete&#34;)] public ActionResult DeleteConfirmed(string id) { User user = db.Users.Find(id); db.Users.Remove(user); db.SaveChanges(); return RedirectToAction(&#34;Index&#34;); } protected override void Dispose(bool disposing) { db.Dispose(); base.Dispose(disposing); } } }</pre> <p><span>and this the context Class (GammeContext) :</span></p> <p><span><br /></span></p> <pre class="brush: csharp">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; namespace MvcApplication2.Models { public class GammeContext:DbContext { public DbSet&lt;Poste&gt; Postes { get; set; } public DbSet&lt;User&gt; Users { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Conventions.Remove&lt;System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention&gt;(); } } }</pre> <p><span>and this is what I added in my web.config file :</span></p> <p><span><br /></span></p> <pre class="brush: xml">&lt;add name=&#34;GammeContext&#34; connectionString=&#34;Data Source=SWEET-DE396641E\SQLEXPRESS;database=Flux; Integrated Security=true&#34; providerName=&#34;System.Data.SqlClient&#34; /&gt;</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/479544/Object-Name-dboPoste-invalid-or-Object-Name-dboUser-invalid-in-Entity-Framework/http://www.aspforums.net/Threads/479544/Object-Name-dboPoste-invalid-or-Object-Name-dboUser-invalid-in-Entity-Framework/Thu, 02 May 2013 02:35:15 GMTMultiple Where conditions in Entity Framework C# .Net<p>i want to get one record <br />with multi condition <br />for example username == "me" and age grather than 20<br />please help me</p>http://www.aspforums.net/Threads/895519/Multiple-Where-conditions-in-Entity-Framework-C-Net/http://www.aspforums.net/Threads/895519/Multiple-Where-conditions-in-Entity-Framework-C-Net/Mon, 15 Sep 2014 04:38:51 GMTInserting into multiple Table using Entity Framework in ASP.Net<p>Hi ,</p> <p>&nbsp;I have a registration page fields are : username , Address , phoneno.</p> <p>i have 3 tables in data base :</p> <p>User : user id primary key , username</p> <p>Address : user id primary key , address&nbsp;</p> <p>Contact : user id , phoneno</p> <p>i am using entity frame work so i got 3class defaultly.</p> <p>now requirement is when i click on register button those fields i have to insert into those &nbsp;3 tables in a proper way</p> <p>Please help regarding this&nbsp;</p>http://www.aspforums.net/Threads/134214/Inserting-into-multiple-Table-using-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/134214/Inserting-into-multiple-Table-using-Entity-Framework-in-ASPNet/Mon, 29 Feb 2016 06:27:12 GMTInsert Repeater rows to Database using Entity Framework in ASP.Net<p>hello&nbsp;</p> <p>&nbsp;</p> <p>i'm trying to insert multiple repeater rows into database but i failed todo that.&nbsp;</p> <p>this what i'm trying to do:</p> <p>&nbsp;</p> <p>&nbsp;</p> <pre class="brush: csharp">foreach (RepeaterItem item in Repeater1.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { Label lblItemNo = (Label)item.FindControl(&#34;lblItemNo&#34;); Label lblCampCode = (Label)item.FindControl(&#34;lblCampCode&#34;); Label lblUom = (Label)item.FindControl(&#34;lblUom&#34;); Label lblBalUnits = (Label)item.FindControl(&#34;lblBalUnits&#34;); Label lblWT = (Label)item.FindControl(&#34;lblWt&#34;); //TextBox txtExitUnits = (TextBox)item.FindControl(&#34;txtExitUnits&#34;); Label lblExitUnits = (Label)item.FindControl(&#34;lblExitUnits&#34;); Label lblcode = (Label)item.FindControl(&#34;lblCode&#34;); HiddenField hfcode = (HiddenField)item.FindControl(&#34;hfCustomerId&#34;); TempExit temp = new TempExit(); temp.tmex_itemno = lblItemNo.Text; temp.tmex_gooddesc = lblCampCode.Text; temp.tmex_UOM = lblUom.Text; temp.tmex_wtbalance = decimal.Parse(lblWT.Text); temp.tmex_unitsbalance = decimal.Parse(lblBalUnits.Text); temp.tmex_ExitUnits = decimal.Parse(lblExitUnits.Text); db.TempExits.Add(temp); db.SaveChanges(); //Response.Redirect(&#34;sendingaspx.aspx&#34;); } }</pre> <p>but i got the following error:</p> <p><strong>Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.</strong></p> <p>&nbsp;</p> <p><strong>can any one help me?</strong></p>http://www.aspforums.net/Threads/174431/Insert-Repeater-rows-to-Database-using-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/174431/Insert-Repeater-rows-to-Database-using-Entity-Framework-in-ASPNet/Sun, 04 Dec 2016 07:53:27 GMTInsert image with query into Entity Framework Database in ASP.Net<p>i have these table:&nbsp;</p> <pre class="brush: sql">CREATE TABLE [dbo].[Images] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Name] NVARCHAR (MAX) NULL, [ContentType] NVARCHAR (MAX) NULL, [Data] VARBINARY (MAX) NULL, [Base64String] NVARCHAR (MAX) NULL, CONSTRAINT [PK_dbo.Images] PRIMARY KEY CLUSTERED ([Id] ASC) ); </pre> <p>Can you help me how to write query to insert image?</p>http://www.aspforums.net/Threads/184954/Insert-image-with-query-into-Entity-Framework-Database-in-ASPNet/http://www.aspforums.net/Threads/184954/Insert-image-with-query-into-Entity-Framework-Database-in-ASPNet/Wed, 16 Mar 2016 06:21:22 GMTImplement Login Form (Page) using Entity Framework in ASP.Net<p><strong>I am new entity frame work I am develop a login form it will &nbsp;work perfectly. </strong></p> <p><strong>So now I want I use login form with the entity frame work .following my code I cannot know how I use it .please help me ..</strong></p> <p><strong>&nbsp;Following my &nbsp;login form code.</strong></p> <p><strong>&nbsp;&nbsp;&nbsp; </strong></p> <p><strong>&nbsp;</strong></p> <p><strong>WebFom1Code</strong></p> <pre class="brush: csharp"> protected void Button1_Click(object sender, EventArgs e) { string strcon = &#34;Data Source=.\\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|Database1.mdf;User Instance=true&#34;; SqlConnection con = new SqlConnection(strcon); SqlCommand com = new SqlCommand(&#34;Emplogin&#34;, con); com.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter(&#34;@Usename&#34;, TextBox1.Text); SqlParameter p2 = new SqlParameter(&#34;@Password&#34;, TextBox2.Text); com.Parameters.Add(p1); com.Parameters.Add(p2); con.Open(); SqlDataReader rd = com.ExecuteReader(); if (rd.HasRows) { rd.Read(); Label3.Text = &#34;Login successful.&#34;; Session[&#34;User&#34;] = TextBox1.Text; Response.Redirect(&#34;WebForm2.aspx&#34;); } else { Label3.Text = &#34;Invalid username or password.&#34;; TextBox1.Text =&#34;&#34;; TextBox2.Text = &#34;&#34;; } } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect(&#34;WebForm1.aspx&#34;); } } } WebForm2.aspx protected void Page_Load(object sender, EventArgs e) { if (Session[&#34;User&#34;] == null) Response.Redirect(&#34;WebForm1.aspx&#34;); } protected void Button1_Click(object sender, EventArgs e) { Session.Remove(&#34;User&#34;); Response.Redirect(&#34;WebForm1.aspx&#34;); } } } </pre> <p>please Help me to Solve it how stored procedure defination Excess in Entity Frame work.</p>http://www.aspforums.net/Threads/168683/Implement-Login-Form-Page-using-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/168683/Implement-Login-Form-Page-using-Entity-Framework-in-ASPNet/Sun, 24 May 2015 06:05:06 GMTHow to tackle Slow INSERT for large amount of data in Entity Framework<p>hi,</p> <p>i'm using this code to update 10,000+ rows in entity framework. But it's taking more than 1 hour to compete transaction. Why it's taking too much time? Is there any solution of it?</p> <p>&nbsp;</p> <pre class="brush: csharp"> foreach (Property item in listProperties) { db.Properties.Attach(item); db.Entry(item).Property(x =&gt; x.pState).IsModified = true; } db.SaveChanges();</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/767740/How-to-tackle-Slow-INSERT-for-large-amount-of-data-in-Entity-Framework/http://www.aspforums.net/Threads/767740/How-to-tackle-Slow-INSERT-for-large-amount-of-data-in-Entity-Framework/Fri, 25 Jul 2014 05:44:49 GMTHow to store binary files (BLOB) data using Entity Framework in C# .Net<p>Hi , I want to store binary files (blob)I searched many forums&nbsp; but didn't found !<br />My question is : how to store binary file (Doc , Pdf , txt..) type blob into database using Entity framework(edmx) With ASP.NET c#<br />please help !</p>http://www.aspforums.net/Threads/109129/How-to-store-binary-files-BLOB-data-using-Entity-Framework-in-C-Net/http://www.aspforums.net/Threads/109129/How-to-store-binary-files-BLOB-data-using-Entity-Framework-in-C-Net/Sun, 10 Nov 2013 23:44:44 GMTImplement jQuery AJAX call with Entity Framework in ASP.Net<p>I am working entity frame work .i have built a function which which check user already exist or not &nbsp;data base so that I that problem I am Jason with a web method but it is not work following my &nbsp;code.</p> <pre class="brush: csharp">JQuey Code &lt;script src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js&#34; type=&#34;text/javascript&#34;&gt; &lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; function UserAvailability() { //This function call on text change. $.ajax({ type: &#34;POST&#34;, url: &#34;AddUser.aspx/CheckUser&#34;, // this for calling the web method function in cs code. Check user is my webmethod. data: &#39;{username: &#34;&#39; + $(&#34;#&lt;%=txtUserName.ClientID%&gt;&#34;)[0].value + &#39;&#34; }&#39;, // user name contentType: &#34;application/json; charset=utf-8&#34;, dataType: &#34;json&#34;, success: OnSuccess, failure: function (response) { alert(response); } }); } // function OnSuccess function OnSuccess(response) { var msg = $(&#34;#&lt;%=lblStatus.ClientID%&gt;&#34;)[0]; switch (response.d) { case &#34;true&#34;: msg.style.display = &#34;block&#34;; msg.style.color = &#34;red&#34;; msg.innerHTML = &#34;User Name already exists.&#34;; break; case &#34;false&#34;: msg.style.display = &#34;block&#34;; msg.style.color = &#34;green&#34;; msg.innerHTML = &#34;User Name Available&#34;; break; } } &lt;/script&gt; ///////Text Box where call ///////////////// &lt;asp:TextBox ID=&#34;TextBoxUserName&#34; autofocus required placeholder=&#34;User Name&#34; runat=&#34;server&#34; onchange=&#34;UserAvailability()&#34;&gt;&lt;/asp:TextBox&gt; &lt;/div&gt; &lt;div id=&#34;checkusernameoremail&#34; runat=&#34;server&#34;&gt; &lt;asp:Label ID=&#34;lblStatus&#34; runat=&#34;server&#34; &gt;&lt;/asp:Label&gt; &lt;/div&gt; ///////////////////////// My stored procedure&hellip; ALTER PROCEDURE User_CheckUserAvailablity @UserName varchar(50) AS BEGIN SET NOCOUNT ON; IF NOT EXISTS (SELECT * FROM Users WHERE UserName = @UserName ) SELECT &#39;true&#39; ELSE SELECT &#39;false&#39; END Below my web method &hellip; [System.Web.Services.WebMethod] public static string CheckUser(User username) -------User is my Table Name and username is object. { string retval = &#34;&#34;; NewEntities db = new NewEntities();--------NewEntites are my EDMX Name db.User_CheckUserAvailablity(------User_Check Availability are my stored procedure name username.UserName ); return retval; } </pre> <p>I think problem in my web method&nbsp; please help me to solve my problem.</p>http://www.aspforums.net/Threads/133621/Implement-jQuery-AJAX-call-with-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/133621/Implement-jQuery-AJAX-call-with-Entity-Framework-in-ASPNet/Thu, 25 Jun 2015 03:16:29 GMTIm unable to insert data in Sql Database by entity framework<p>I'm follow your code(<a href="https://www.aspsnippets.com/Articles/Entity-Framework-CRUD-Select-Insert-Edit-Update-Delete-using-Entity-Framework-in-ASPNet.aspx">code link</a>) from here. but I don't understand where I use AddToCustomers Method and I'm unable to Add NameSpace "TestModelNs".<br />Here is my aspx file(<a href="https://drive.google.com/open?id=1fzU9WAc92-45cYJU62Ca469KPCMe7gF0">files link</a>)</p>http://www.aspforums.net/Threads/598370/Im-unable-to-insert-data-in-Sql-Database-by-entity-framework/http://www.aspforums.net/Threads/598370/Im-unable-to-insert-data-in-Sql-Database-by-entity-framework/Sun, 03 Dec 2017 01:05:54 GMTHow to publish asp net mvc application with entity framework database to IIS<p>Please help me with publishing mvc application with ef database. The application starting in the browser but when i go to view with data from database, give me this error. What can i do</p> <p>&nbsp;</p> <h2><em>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.<br />)</em></h2> <p><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><strong>Description:&nbsp;</strong>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.&nbsp;<br /><br /><strong>Exception Details:&nbsp;</strong>System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.<br />)<br /><br /><strong>Source Error:</strong>&nbsp;<br /><br /></font></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><code>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code></td> </tr> </tbody> </table> <p>&nbsp;</p>http://www.aspforums.net/Threads/216106/How-to-publish-asp-net-mvc-application-with-entity-framework-database-to-IIS/http://www.aspforums.net/Threads/216106/How-to-publish-asp-net-mvc-application-with-entity-framework-database-to-IIS/Wed, 09 Mar 2016 07:45:04 GMTHow to perform multiple field search in Entity Framework<p>hi</p> <p>iam need multi search</p> <p>i want when user <span id="result_box" lang="en"><span class="hps">Each of the</span> <span class="hps">fields</span> <span class="hps">can be</span> <span class="hps">filled in</span> <span class="hps">the picture below</span></span></p> <p><span id="result_box" class="short_text" lang="en"><span class="hps">Search</span> <span class="hps">results</span> <span class="hps">show</span> <span class="hps">the</span> <span class="hps">filling of</span> <span class="hps">fields</span></span></p> <p>iam need this query with linq<br /><span class="short_text" lang="en"><span class="hps"><br /></span></span></p> <p><img src="http://1.graph.uphero.com/up/0aee3a5f4643.png" alt="search" width="550" height="85" /></p> <p>&nbsp;</p> <pre class="brush: csharp"> var Query = (from P in temp1.Vbuys where P.Fage == Tage.text.trim() select new { P.Tname, P.TFamil,P.Tage }).ToList(); </pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/982531/How-to-perform-multiple-field-search-in-Entity-Framework/http://www.aspforums.net/Threads/982531/How-to-perform-multiple-field-search-in-Entity-Framework/Mon, 01 Apr 2013 00:40:53 GMTGet image from Entity Framework database and send to email in ASP NET MVC<p>Can you help me how to get the image from database and send to email using asp net mvc. I have two models now, one for Images and one for EmailForm. How to connect them in one view, and what do i need to have in controller?&nbsp;</p>http://www.aspforums.net/Threads/594197/Get-image-from-Entity-Framework-database-and-send-to-email-in-ASP-NET-MVC/http://www.aspforums.net/Threads/594197/Get-image-from-Entity-Framework-database-and-send-to-email-in-ASP-NET-MVC/Mon, 14 Mar 2016 10:04:49 GMTHow to pass null value to Stored Procedure using Entity Framework in ASP.Net<p>I have store procedure in sql server, it have many allow null parameters, except @Action:&nbsp;</p> <pre class="brush: sql">ALTER Procedure [dbo].[pDepartmentCRUD] @Action varchar(10), @AreaID int = null, @DeptID int = null, @DeptName nvarchar(100) = null, @DeptAddress nvarchar(300) = null, @DeptPhone nvarchar(50) = null, @AreaName nvarchar(100) = null AS BEGIN SET NOCOUNT ON; --SELECT IF @Action= &#39;SELECT&#39; IF @AreaName IS NOT NULL and @DeptName IS NOT NULL -- search Dept by DeptName or AreaName BEGIN Select DeptID,DeptName,DeptAddress,DeptPhone, AreaName, d.AreaID from Department d inner join Area a on d.AreaID = a.AreaID where AreaName like &#39;%&#39; + @AreaName + &#39;%&#39; or DeptName like &#39;%&#39; + @DeptName + &#39;%&#39; END ELSE IF @AreaID IS NOT NULL -- select by AreaID BEGIN Select DeptID,DeptName,DeptAddress,DeptPhone, AreaName, d.AreaID from Department d inner join Area a on d.AreaID = a.AreaID where d.AreaID = @AreaID END ELSE BEGIN Select DeptID,DeptName,DeptAddress,DeptPhone, AreaName, d.AreaID from Department d inner join Area a on d.AreaID = a.AreaID END ......................................</pre> <p>in Controller, i must call it with many null parameters:&nbsp;</p> <pre class="brush: csharp">var tr = TestEquipDBEntities.pDepartmentCRUD(&#34;SELECT&#34;, null, null, null, null, null, null).ToList();</pre> <p>how can i call it with like call procedure with only @Action parameter, like in sql:</p> <p>exec pDepartmentCRUD @Action = 'SELECT'</p>http://www.aspforums.net/Threads/135044/How-to-pass-null-value-to-Stored-Procedure-using-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/135044/How-to-pass-null-value-to-Stored-Procedure-using-Entity-Framework-in-ASPNet/Mon, 10 Apr 2017 03:50:13 GMTHow to compare varbinary column in Entity Framework using C# in ASP.Net<p>Hello,</p> <p>Below is my code</p> <pre class="brush: csharp">USER_MASTER usrmst = entity.USER_MASTER.Where(user =&gt; user.PASSWORD.SequenceEqual(a).FirstOrDefault());</pre> <p>Here Password is my varbinary column when I am trying to convert,it throws an error,</p> <p>CANNOT CONVERT LAMBDA EXPRESSION TO TYPE STRING,BECAUSE IT IS NOT A DELEGATE TYPE </p> <p>please guide me,how to compare this.</p>http://www.aspforums.net/Threads/176946/How-to-compare-varbinary-column-in-Entity-Framework-using-C-in-ASPNet/http://www.aspforums.net/Threads/176946/How-to-compare-varbinary-column-in-Entity-Framework-using-C-in-ASPNet/Mon, 10 Apr 2017 04:30:44 GMTHow to check if any ICollection is null in entity object in ASP.Net<p>how to check if any &nbsp;ICollection is null in entity object</p>http://www.aspforums.net/Threads/181800/How-to-check-if-any-ICollection-is-null-in-entity-object-in-ASPNet/http://www.aspforums.net/Threads/181800/How-to-check-if-any-ICollection-is-null-in-entity-object-in-ASPNet/Fri, 24 Jun 2016 03:03:46 GMTHow to call Stored Procedure from Entity Framework using Code First in ASP.Net<p>Hi,</p> <p>I am using entity framework code first in my application.</p> <p>I have stored procedure and i want to pass it a parameter and get 2 return values from stored proc.</p> <p>&nbsp;</p> <p>How to write&nbsp;&nbsp;entity framework code first CODE in c# page?</p> <p>&nbsp;</p> <p>Thanks.</p>http://www.aspforums.net/Threads/637050/How-to-call-Stored-Procedure-from-Entity-Framework-using-Code-First-in-ASPNet/http://www.aspforums.net/Threads/637050/How-to-call-Stored-Procedure-from-Entity-Framework-using-Code-First-in-ASPNet/Wed, 01 Feb 2017 06:16:16 GMTGet the sum of column using Entity Framework in ASP.Net<p>hello i'm trying to implement the following sql statement using entity framework&nbsp;</p> <p>&nbsp;</p> <pre class="brush: sql">select coalesce(SUM(cdin_ActMortgageAmnt),0) from CRM.dbo.CDIndex,CRM.dbo.company where comp_companyid=cdin_companyid and comp_idcust like &#39;%10319%&#39; and cdin_Deleted is null and cdin_startunstufdate is not null and cdin_Status=&#39;InProgress&#39; </pre> <p>&nbsp;</p> <pre class="brush: csharp">Company c = db.Companies.Find(750); var CGP = (from cd in db.CDIndexes join com in db.Companies on cd.cdin_CompanyId equals com.Comp_CompanyId where com.Comp_IdCust == c.Comp_IdCust &amp;&amp; cd.cdin_Deleted == null &amp;&amp; cd.cdin_startunstufdate == null &amp;&amp; cd.cdin_Status == &#34;InProgress&#34; select new { act=cd.cdin_ActMortgageAmnt } ); var query = CGP.Sum(x =&gt; x.act); lblSum.Text = query.ToString(); </pre> <p>but when i trace the code var query gives me null ? Please help&nbsp;</p>http://www.aspforums.net/Threads/434981/Get-the-sum-of-column-using-Entity-Framework-in-ASPNet/http://www.aspforums.net/Threads/434981/Get-the-sum-of-column-using-Entity-Framework-in-ASPNet/Tue, 13 Dec 2016 02:53:27 GMT