Tagged Questions
0
votes
1answer
36 views
How can I run a stored procedure that has no return values from C# with my db context?
I am using the following code to run a stored procedure:
MyContext db = new MyContext();
var a = db.Database.SqlQuery<string>("dbo.getQuestionUIdsByTopicId @TopicId",
new ...
0
votes
1answer
15 views
entity framework database issue - A network-related or instance-specific error occurred while establishing a connection to SQL Server
A network-related or instance-specific error occurred while establishing a connection to SQL Server
The main page loads fine, but the error occurs when I try to goto Account/Register or ...
2
votes
0answers
16 views
Stored Procedure for finding N Level Child List
Recently i came across one problem of finding N Level Child from tables.
Let say we have following list of tables:
Table: **Country**
PKCountryID
CountryCode
CountryName
Table: **State**
PKStateID
...
0
votes
1answer
42 views
Create DB trigger to crud operation for audit
I need to create DB trigger to azure db that when user click change something in the table a trigger will write this event to a table,write what was changed ,timestemp etc.
Currently I have two basic ...
0
votes
1answer
8 views
How can I drop second Primary Key in MVC model?
I have model that has 2 primary key. I wanna drop one of them but I got an error.
My Model;
public class Equipment
{
[Key]
[Column(Order = 0)]
public int EquipmentId { ...
0
votes
0answers
14 views
The system cannot find the file specified when open Product View in Browser
I got this project from another computer. When I try to open it in a browser the default Home view can be viewed. But the others that were retrieved from a Database in SQL always give me the below ...
2
votes
2answers
45 views
Regular expression to accept 5 characters with optional
Hi i have to write a regular expression that should match the format like A12BC. Here first 2 characters that is A & 1 is mandatory and next 3 characters 2, B & C are optional. Currently my ...
0
votes
1answer
29 views
error 50 - Local Database Runtime error occurred and ASP.NET MVC
This is 2nd day I'm spending on this sql server problem! long story short, I have downloaded/installed sql server 2014 express version on my windows 8.1 operating system. sql server works fine however ...
0
votes
0answers
12 views
How to Union two collections using LINQ and return a IQueryable
I'm trying to UNION the results of these two collections. Each both PremisePricing and PremiseMeteredPricing all the fields have same name and data type with the exception of their Respective Primary ...
-1
votes
2answers
31 views
How to create complex join query in entity framewok [closed]
I am new to entity framework,i want to create a query in entity framework in mvc4
following are my two tables
and i want output as
please help.
0
votes
0answers
25 views
Can we call Web API(.Net MVC) in SQL Server Store Procedure?
I am trying to call like this
Alter Procedure [dbo].[sp_ExWebServiceCall]
@UserId varchar(15) = null
As
Begin
Declare @Object int
Declare @URL nvarchar(200)
Declare @Response ...
-1
votes
1answer
27 views
Search with multi field in asp.net mvc and sql server
Please help me with my problem below:
I have one table in sql server with field: product, customer, year, quantity,...
And i have a search form with 3 textbox: txtprod, txtcust, txtyear and search ...
1
vote
1answer
87 views
Asp.net MVC real time application performance
i'm trying to create an asp.net mvc web application ,some pages need to show the data in "real time" ,this data is on a sql server database ,the data is changing always
i created a stored procedure ...
2
votes
1answer
41 views
Entity Framework and whole word matching - paging and filtering results
Background:
I am using ASP.NET MVC4, SQL Server 2008 R2, and Entity Framework 5 for a website.
The site accepts a delimited list of keywords to search database content on. It also needs to page the ...
0
votes
0answers
23 views
JsTree3Node and population of data from an existing table
Have a question on recursively populating JsTree using the .NET wrapper available via NuGet. Any help would be greatly appreciated.
the .NET class JsTree3Node has a property named Children which ...
1
vote
1answer
27 views
Database is throwing an InvalidOperationException status of 500 in a MVC Web Application while accessing data from an SQL View
I am working on an Asp.Net MVC Application in which I have an SQL View with five columns and I have the following model for it
public class InferredBid
{
public int Id { get; set; }
...
1
vote
1answer
32 views
How to auto increment composite key Id only when a specific condition is met?
I have a code first MVC 5 project with a model that has a composite key:
public class XYZ
{
[Key]
[Column(Order = 1)]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ...
0
votes
2answers
20 views
Error editing MVC website
I tried to create a MVC website and tried to connect SQL Database with that website. While trying to edit the DB through the website I got the following error,
using System;
using ...
0
votes
1answer
40 views
Representing paths in SQL Server database (ASP.NET MVC)
I am writing a small bookmarking tool in ASP.NET MVC, and each bookmark is stored in a folder. I am currently representing this by simply storing a path as a string in the database, but when it comes ...
0
votes
2answers
40 views
Best way to do cross database union query in EF code first
i'm working on an ASP.NET MVC project with EF code first as database modelling.
It's a multi user application in which everyone has it's own database, what i need now is the ability to list all Posts ...
1
vote
1answer
38 views
connection to OLAP cube?
I made an OLAP cube in Microsoft BI and deployed it on server. Now I want to make a web app ( ASP.Net MVC) on which I woud like to display reports (dashboards) from OLAP cube, but I dont know how to ...
1
vote
0answers
50 views
EF 6 seamless connection with both Ms SQL and MySQL
I have ASP.NET MVC application with default MS SQL 2012 data source. I need to make same app to work with MySQL db without much code change or separate compilation since both database are exact ...
0
votes
0answers
44 views
Asp.net mvc using EntityFramework: loading Person by passing id is retrieving a Object but Object properties are null?
i am hanging for while and i dont understand one thing...I will try to explain my issue...
I have model(Table) called FeuerwehrPerson and the class looks like that:
public partial class ...
0
votes
1answer
31 views
What is the best way to mange Time Zones when Server and Client are in different zones?
I have a MVC app and a Shared MS SQL DataBase in a physical location at GMT -7.
User for the app are based at GMT +2 and all records should be recorded with time GMT +2.
When in .Net or directly ...
0
votes
0answers
59 views
MVC 4 - calling update stored procedure using AJAX
I am currently working on a project on MVC 4 that need to call a view of edit that will edit records from sql table. I am currently working with Sql Commands to interact with the database, Not Entity ...
-4
votes
2answers
58 views
storing image in sql server database using asp.net framework and mvc architecture [closed]
How to send an ajax call to controller that contains image as argument that is to be saved in database.I have asked user to upload image now I do not know how to send that image as argument to ...
0
votes
1answer
44 views
Clean and reset table in mvc 4 Web application
I am wanting to delete all data from a table and reset the id column to 1. I want to do this in my controller, but i want to know the best way to do that. I have tried the SQLConnection/SQLCommand ...
0
votes
0answers
43 views
Connecting to SQL Server database no opening MVC 4
I am having trouble connecting to my database to run a query. Here us the connection and query info:
string connectionString = "Data ...
0
votes
1answer
22 views
MySQLRoleProvider error on Asp.NET MVC Application but using SLServer only
I'm new on this. I got a sample project that runs perfectly on another pc but get an error when running on my own pc. I changed the connection string and restored the database only. I am using a ...
0
votes
1answer
43 views
Getting unique IDs from a database for a non-unique column - asp.net mvc code first
I have a rather unique problem so I thought I'd ask here:
I need to put together a Code First model where the user has 2 ID fields, one unique (identifying each user separately), and one which won't ...
0
votes
1answer
29 views
Displaying View with custom SQL Query
So I am still new to MVC and SQL.
What I am trying to do is display an Employee's name (Employee.Name) rather than their ID (MovieEmployees.ID) on the Index view for Movies (i.e. localhost/Movies/)
I ...
0
votes
0answers
12 views
MVC + WCF + IIS + SQL Login fails with machine name
We have a WCF service running under IIS that accesses an SQL database. The service works fine with the test client in Visual Studio and we can access it on IIS through its URL, but when we try to use ...
-1
votes
1answer
44 views
Cannot insert duplicate key row in object 'dbo.CLIENT' with unique index '@KOD_CLIENT'
This is the code:
string CLIENT = "declare @KOD VARCHAR(10)
set @KOD = 'K' + (SELECT CAST(MAX(SUBSTRING(KOD,3,4)) + 1 as VARCHAR(7)) KOD
FROM CLIENT
...
0
votes
2answers
51 views
Entity Framework not creating Tables
I really have no luck with the EF every time. This time it looks like this:
First time i created a context i had an error like:
Invalid object name 'dbo.TableName1'
After this setting the ...
0
votes
1answer
80 views
How to handle session time out Error in MVC application?
I am developing an ASP.NET MVC application with a SQL Server database.
I have no idea about how to handle the process when session get time out.
I have searched on stack but all questions describes ...
0
votes
1answer
29 views
CRUD for multiple models in one View MVC
I'm using MS SQL Server and ASP.NET MVC 4. Now I have 10 customers and each customer has it's own database. In each database contains 4 tables which are table1, table2, table3, table4.
I want to ...
0
votes
0answers
68 views
“Invalid object name” Entity Framework
I've just started learning ASP.NET MVC. I've got a problem with Entity Framework.
namespace MVCDemo.Models
{
[Table("tabelka")]
public class Employee
{
public int EmployeeID { get; ...
-1
votes
3answers
87 views
Free SQL Server in Azure
I'm creating a MVC 5 web application with EF 6 Code first. Now it creates a database in the App_Data folder. I want to publish the website to an Azure website. Because this is only the test version of ...
0
votes
2answers
57 views
Separating database, services and IIS to different servers
We're building a web application using Asp.net MVC with Sql Server database.
This application is supposed to serve hundreds of users or even thousands.
In order for it to be scalable, We want to ...
0
votes
1answer
62 views
Logging in to SQL Server using SQL logins with ASP.NET MVC
I am writing a small addon mobile app to an existing applications database, the application stores login details through SQL Server logins:
I want to be able to use these existing logins (and ...
0
votes
1answer
39 views
Stored Procedure taking a long time to return in Controller but not in Query Analyzer
I have a stored procedure that I'm running in my ASP.Net MVC 4 application. The procedure does a lot of processing of records and packages up the records in a nice result set. When I run this sproc ...
1
vote
1answer
16 views
Is there a tool to tell me how much data my web application is getting from the database
I am creating a MVC web application using Visual Studio 2013 and was wondering if there is a tool to tell me how much data is being retrieved on each page when a request is made?
Is there something ...
0
votes
0answers
57 views
Returning multiple models in a list to one view
I am having an issue returning multiple models in one view. I have a model that has a collection of other models. So when I return the model (ProblemsVM) that has the collection of the other 2, I ...
0
votes
4answers
113 views
Foreign Key constraint error when performing fresh install of Piranha CMS
Piranha CMS is a programmer oriented CMS (I prefer to write it since I've been downvoted last time!). I've spent all the afternoon trying to fix this problem : Whether I try to migrate from a Sql ...
0
votes
3answers
123 views
Setting Default Value of DropDownList in MVC
I've been looking around, and I can't quite find someone attempting to do quite what I am. I have several models that work together on a single page. The models are employees1, phone_manager, and ...
0
votes
3answers
44 views
Does every property of an entity need to be included in an update
I have an entity "Rep"...
public partial class rep
{
public string repid { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Title { ...
0
votes
1answer
45 views
Populating a DropDownListFor with values from another model linked by a foreign key?
I'm building a web application for my company. One of my models is an employee model, employees1, and it is quite complex. One issue I've run into is inserting values into my phone_manager table, ...
0
votes
3answers
53 views
SQL Server 2012 Date datatype contains 12:00:00AM
I have a MVC CRUD site that has a Date Approved Textbox. When the new entry is created it is stored properly as "dd-MM-yyyy" in the SQL Sever. When I want to update an entry the Date Required textbox ...
0
votes
1answer
55 views
Error on trying to Update-Database code first
I'm trying to update my db after adding a few classes that need to be tables in the database.
I'm getting the following Error:
There is already an object named 'Blogs' in the database.
My data ...
-1
votes
2answers
63 views
Converting SQL Query to LINQ for application
I have a query in TSQL that I am trying to convert to LINQ for use in our web application, but I am really struggling with this one. It is MVC5 with EF6 and the database is SQL Server 2008 R2. Any ...