这是一个奇怪的!我有点想说我的replace功能不正常的原因是因为字体.我以前从未见过这个问题,我想知道我是否忽略了什么!?
我将以下变量设置为静态文本'.
var lastName = "O'Donnell";
Run Code Online (Sandbox Code Playgroud)
在我的浏览器中,console.log(lastName)输出:O’Donnell.而不是O'Donnell.因此,以下替换方法不起作用.
return lastName.replace(/'/g, '')
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我想将sp_formCreateEventID存储过程返回的值赋给新变量(@eventId)。我最初以为这是要走的路。该解决方案也符合SSMS生成的EXEC命令。
但是,由于某种原因,该EXEC行INT按预期从存储过程返回了a ,但是当它不能将其值分配给该@eventId变量时。
DECLARE @eventId INT
EXEC @eventId = sp_formCreateEventID @patientId, @programId, @clinicianId, @formId, @phaseTypeId, @draft, @dataCollectionDate, NULL
SELECT @eventId
Run Code Online (Sandbox Code Playgroud)
sp_formCreateEventID (不要恨我,我没有写这个……):
ALTER PROCEDURE [dbo].[sp_formCreateEventID]
@PatientID int,
@ProgramID int,
@ClinicianID int,
@FormID int,
@PhaseTypeID int,
@Draft varchar(5),
@CompletedDate varchar(40),
@UserID int = null
AS
BEGIN
IF @CompletedDate = ''
SET @CompletedDate = NULL
--for some forms such as Clinical Input - Initial, there should only have one form …Run Code Online (Sandbox Code Playgroud) 在我的 .net core 3.1 Web api 项目中,我正在使用Microsoft.AspnetCore.Odata和Microsoft.AspnetCore.Mvc.NewtonsoftJson. 我的启动看起来像这样:
services.AddOData();
services.AddControllers(options =>
{
IEnumerable<ODataOutputFormatter> outputFormatters =
options.OutputFormatters.OfType<ODataOutputFormatter>()
.Where(foramtter => foramtter.SupportedMediaTypes.Count == 0);
foreach (var outputFormatter in outputFormatters)
{
outputFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/odata"));
}
}).AddNewtonsoftJson(options =>
{
options.UseCamelCasing(false);
options.SerializerSettings.ContractResolver = new DefaultContractResolver() { NamingStrategy = new CamelCaseNamingStrategy() };
});
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
endpoints.MapControllers().RequireAuthorization();
endpoints.EnableDependencyInjection();
endpoints.Select().OrderBy().Filter();
endpoints.MapODataRoute("odata", "odata", GetEdmModel());
});
}
IEdmModel GetEdmModel()
{
var builder = new ODataConventionModelBuilder();
builder.EnableLowerCamelCase();
builder.EntitySet<Ebp>("Ebp");
return builder.GetEdmModel(); …Run Code Online (Sandbox Code Playgroud)