core

Blazor select bind to a value in a list [duplicate]

半腔热情 提交于 2021-02-19 08:43:10
问题 This question already has answers here : blazor variable argument passing to onclick function (2 answers) Closed last year . I was able to bind an int type (which is the first element of the list SelectedDiagnosisIdList) variable to the selected element of a html select: <div> <label>Diagnosis:</label> <div> <select @bind="@userInfo.SelectedDiagnosisIdList[0]"> @foreach (var item in diagnoses) { <option value="@item.Id">@item.Name</option> } </select> <p>@userInfo.SelectedDiagnosisIdList[0]"<

SqlException: Login failed for user 'DOMAIN\MACHINENAME$' for SQL Server with .NET Core 2.1

谁都会走 提交于 2021-02-11 15:51:47
问题 Here is the contents of my connection string. It is an .NET Core 2.1 web application. When I run on my PC, it works fine. When I deploy it to IIS and run it, this error will occur. The detailed error is after the appsetting. "Testing2012Context": "Server=Server;Database=Testing2012;User ID=User;Password=Pwd;Trusted_Connection=False;MultipleActiveResultSets=true" Error: SqlException: Login failed for user 'DOMAIN\MACHINENAME$' for the SQL Server with .NET Core 2.1 ... System.Data.SqlClient

SqlException: Login failed for user 'DOMAIN\MACHINENAME$' for SQL Server with .NET Core 2.1

二次信任 提交于 2021-02-11 15:49:55
问题 Here is the contents of my connection string. It is an .NET Core 2.1 web application. When I run on my PC, it works fine. When I deploy it to IIS and run it, this error will occur. The detailed error is after the appsetting. "Testing2012Context": "Server=Server;Database=Testing2012;User ID=User;Password=Pwd;Trusted_Connection=False;MultipleActiveResultSets=true" Error: SqlException: Login failed for user 'DOMAIN\MACHINENAME$' for the SQL Server with .NET Core 2.1 ... System.Data.SqlClient

MVC Core 3 FromSqlRaw parameters not working as expected

好久不见. 提交于 2021-02-11 15:38:38
问题 Has anyone else run into the issue of FromSqlRaw parameters not working as expected? There is a Gotcha to be aware of. With the latest MVC Core 3 DbContext I added a stored procedure but could not get the FromSqlRaw call to correctly evaluate parameters. SqlParameter[] parameters = { new SqlParameter("DateFrom", dateFrom), new SqlParameter("DateTo", dateTo), new SqlParameter("Sort", sort), new SqlParameter("Aggregation", aggregation) }; return await sp_Visits.FromSqlRaw("EXECUTE dbo.sp_Visits

MVC Core 3 FromSqlRaw parameters not working as expected

眉间皱痕 提交于 2021-02-11 15:36:34
问题 Has anyone else run into the issue of FromSqlRaw parameters not working as expected? There is a Gotcha to be aware of. With the latest MVC Core 3 DbContext I added a stored procedure but could not get the FromSqlRaw call to correctly evaluate parameters. SqlParameter[] parameters = { new SqlParameter("DateFrom", dateFrom), new SqlParameter("DateTo", dateTo), new SqlParameter("Sort", sort), new SqlParameter("Aggregation", aggregation) }; return await sp_Visits.FromSqlRaw("EXECUTE dbo.sp_Visits

Entity Framework Core- passing parameters to Where IN Clause Raw Query

心不动则不痛 提交于 2021-02-11 06:25:20
问题 I just want to select data for range of values from db. e.g. "SELECT * from VwCampaigns where PmcId in (1,2,3)" This is my code in Entity Core _dbContext.CampaignsView.FromSql("SELECT * from VwCampaigns where PmcId in ({1})", pmcIds).ToList() How to pass range of integer in raw query? Please Help 回答1: I do not think there is any way to do it by passing a list of Ids as a parameter because EF tries to interpret it as a single parameter. What worked for me was the following: Given a list of IDs

How to consume SOAP web service from .NET Core 3.0 WPF app

こ雲淡風輕ζ 提交于 2021-02-08 11:21:27
问题 I have a SOAP web service. I want to consume it in my WPF app. I am using .NET Core 3.0, Visual Studio 2019. So I used the Microsoft WCF Web Service Reference Provider to add reference to my project. This created the following classes: and Now, how do I use these to get my data by calling the web service? I tried the following; is this the correct way to call the web service? In many examples that I have seen on the internet, the client constructor does not need the EndpointConfiguration

.NET Core on Azure can't connect to SQL Server Database

本秂侑毒 提交于 2021-02-01 05:17:59
问题 I have a .NET Core API backend which is published on Azure. I also have a SQL Server database running on Azure, if I run my backend app locally it succesfully connects to the online database, reading/writing etc works fine. When running the online backend however, every API call results in a 500 error. When looking in the logs there is the following error which probably causes the 500: Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred

.NET Core on Azure can't connect to SQL Server Database

心已入冬 提交于 2021-02-01 05:16:27
问题 I have a .NET Core API backend which is published on Azure. I also have a SQL Server database running on Azure, if I run my backend app locally it succesfully connects to the online database, reading/writing etc works fine. When running the online backend however, every API call results in a 500 error. When looking in the logs there is the following error which probably causes the 500: Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred

.NET Core Publish Compilation Errors

梦想的初衷 提交于 2021-01-29 04:58:57
问题 I have a .NET Core 2.2 project that builds in both Debug and Release configuration just fine. However, the build fails when I try and publish the project. Startup.cs(26,16): Error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?) Startup.cs(35,39): Error CS0246: The type or namespace name 'IServiceCollection' could not be found (are you missing a using directive or an assembly reference?) Startup.cs(29,24):