Tag: asp.net

SQL Delete Query Foreign Key constraint

I am trying to Delete record with primary key as foreign key in two tables. Everytime I try to run the query it gives me this error: Query: DELETE FROM BusinessPlus_Post FROM BusinessPlus_Post INNER JOIN BusinessPlus_PostImage ON BusinessPlus_Post.Post_ID = BusinessPlus_PostImage.BusinessPlusPost_ID INNER JOIN BusinessPlus_PostTag ON BusinessPlus_Post.Post_ID = BusinessPlus_PostTag.BusinessPlusPost_ID WHERE (BusinessPlus_Post.Post_ID = 3) AND (BusinessPlus_PostImage.BusinessPlusPost_ID = 3) […]

Connecting to SQL Server Express database with c# asp.net

I was able to connect to a database on a server on my network with no problem. However, when I attempt to use SQL Server Express (local db), I keep getting the same error. I created a new solution with only a button and label as to eliminate any other potential issues. I have looked […]

Large number of database reads while calling procedure using Entity Framework 4

In my asp.net c# application I am calling a procedure using entity framework 4.0 my problem is that on live site I receive time out issue (it takes more than 1 min to complete execution) But same procedure when I call from management studio (sql server 2012) it takes hardly 6 sec (even after using […]

Why can't I access my database on a webpage?

I am getting an error on my web project. I have an aspx website that has a page that I use to view a database of a personal vinyl record collection. I used visual studio 2013 Professional to create the entire site and database. It works perfectly fine when I run the project in the […]

How to show NULL value using GridView in asp.net?

I am using gridview to fetch the data from sqlserver. there are few values which are NULL. How to show these values using Gridview?

Login failed for user 'IIS APPPOOL\myAppPoolName' and cannot add new user for this

I am getting the following error while asp.net app trying to connect database. Login failed for user ‘IIS APPPOOL\myAppPoolName’. I use ms SqlServer 2008 r2, windows server 2008 r2. This happened when I’ve just moved the application and database from one server to another. I thought adding a new user to database named ‘IIS APPPOOL\myAppPoolName’ […]

Difference between EF.SqlServer and EF.SqlServerCompact

I want to install Entity Framework in my ASP.NET 5 MVC project using project.json. In the dependencies section I start typing EntityFramework and I only see “EntityFramework.SqlServerCompact”: “6.1.3” instead of “EntityFramework.SqlServer”: “6.1.3”. What is the reason for this and what effects will this have? Are there limitations in the compact version? If I create a […]

Gridview is updated with SqlCommand but then edit and delete are no longer working

I have a gridview (bound to a SQL Server database), a textbox and a button. I can delete or edit the values in the gridview. All works fine. No need to put any code myself, it is there by default. However in the textbox I can put a value with a button to narrow down […]

Hash passwords using crypto and then save to database

Currently i have this code // POST: users/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = “id,naam,wachtwoord,email,isadmin”)] user user) { user.wachtwoord = Crypto.HashPassword(user.wachtwoord); if (ModelState.IsValid) { db.users.Add(user); db.SaveChanges(); return RedirectToAction(“Index”); } return View(user); } now […]

SQL Server procedure to find rows from table that its id starts with a specific number not working

I’m trying to write a SQL Server stored procedure that returns a list of string, then I will use this returned list in AjaxAutoCompleteExtender in my ASP.Net website, so when the user start typing a string (e.g. 60), the procedure should return the names of all the users where there ids’ starts with the input […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.