CREATE TABLE [dbo].[AdminTest] (
[AdminTestId] INT IDENTITY (1, 1) NOT NULL,
[Title] NVARCHAR (100) NOT NULL,
[CreatedBy] INT NOT NULL,
[CreatedDate] DATETIME NOT NULL,
[ModifiedBy] INT NOT NULL,
[ModifiedDate] DATETIME NOT NULL,
[TestLevelId] INT NOT NULL,
[TestStatusId] INT NOT NULL,
[ExamId] INT NOT NULL,
[Text] NVARCHAR (MAX) NULL,
[Sequence] INT DEFAULT ((1)) NOT NULL,
[Release] NVARCHAR (50) DEFAULT ((1)) NOT NULL,
[Version] ROWVERSION NOT NULL,
[Price] MONEY DEFAULT ((0)) NOT NULL,
[ReleaseDate] DATETIME NULL,
[Code] VARCHAR (10) DEFAULT (LEFT(newid(), (5))) …Run Code Online (Sandbox Code Playgroud) 我使用以下代码来设置调用存储过程的参数:
List<SqlParameter> parameterList = new List<SqlParameter>();
parameterList.Add(new SqlParameter("@Title", adminTest.Title));
parameterList.Add(new SqlParameter("@Text", adminTest.Text));
var questionsList = new SqlParameter("@Questions", questions);
questionsList.TypeName = "dbo.QuestionList";
parameterList.Add(questionsList);
Run Code Online (Sandbox Code Playgroud)
该代码片段有效,但我想知道是否有人找到了TypeName在新的 SqlParameter 构造函数中设置 的方法?我尝试查看文档,但我唯一能找到的就是之后添加类型名。
这是我正在使用的代码:
public async Task<IHttpActionResult> NewTopicTests([FromBody] NewTopicTestsDTO testSpec)
{
var sql = @"dbo.sp_new_topic_tests @Chunk";
SqlParameter[] parameters = new SqlParameter[]
{
new SqlParameter("@Chunk", testSpec.Chunk)
};
int result = db.Database.ExecuteSqlCommand(sql, parameters);
await db.SaveChangesAsync();
return Ok();
}
Run Code Online (Sandbox Code Playgroud)
有人可以确认这是否是使用异步执行此操作的正确方法?特别是我需要这样做:
int result = db.Database.ExecuteSqlCommand(sql, parameters);
await db.SaveChangesAsync();
Run Code Online (Sandbox Code Playgroud)
请注意,代码有效,但我的应用程序出现问题,突然停止,没有任何错误消息.我正在调查每一个可能的问题.
sql-server asp.net entity-framework asp.net-web-api entity-framework-6
我试过这个:
<div style="padding: 1rem 0;background-color:red">
<div style="width: 90%;margin: 0 auto 0 auto; background-color:red">
xxx
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
但是内部DIV只占用了xxx的足够空间.如何让内部DIV具有90%的外部宽度?
我的模块是用 Typescript 创建的:
angular.module('admin', ['ngMessages'])
.service('homeService', HomeService)
.controller('adminHomeController', AdminHomeController)
.controller('adminContentController', AdminContentController)
.filter('sdate', function ($filter) {
var angularDateFilter = $filter('date');
return function (theDate) {
return angularDateFilter(theDate, 'yyyy-MM-dd');
}
});
Run Code Online (Sandbox Code Playgroud)
在我的 HTML 页面上,我引用了这样的过滤器:
{{ row.createdDate | sdate }}
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误:
Error: [$injector:unpr] Unknown provider: nProvider <- n <- sdateFilter
http://errors.angularjs.org/1.3.0-beta.8/$injector/unpr?p0=nProvider%20%3C-%20n%20%3C-<div data-ui-view="content" id="contentBlock" class="ng-scope">dateFilter
at http://127.0.0.1:17316/Scripts/bundle/library.js:80:20
at http://127.0.0.1:17316/Scripts/bundle/library.js:3837:27
at Object.getService [as get] (http://127.0.0.1:17316/Scripts/bundle/library.js:3969:53)
at http://127.0.0.1:17316/Scripts/bundle/library.js:3842:53
at getService (http://127.0.0.1:17316/Scripts/bundle/library.js:3969:53)
at Object.invoke (http://127.0.0.1:17316/Scripts/bundle/library.js:4001:25)
at http://127.0.0.1:17316/Scripts/bundle/library.js:3843:45
at Object.getService [as get] (http://127.0.0.1:17316/Scripts/bundle/library.js:3969:53)
at null.$filter (http://127.0.0.1:17316/Scripts/bundle/library.js:14624:34)
at Parser.filter (http://127.0.0.1:17316/Scripts/bundle/library.js:10627:27) …Run Code Online (Sandbox Code Playgroud) 我有一个web api应用程序,我正在考虑转向HTTPS.原因实际上只是初次登录,我想隐藏用户名和密码.
登录后,来自页面的所有其他呼叫还需要是HTTPS吗?例如,我对CSS和脚本的调用是否需要通过HTTPS传输?WebAPI如何调用?
我有:
<label for="modalProblemLocator">
<span>Locator</span>
<span>xxx</span>
</label>
<label for="modalProblemLocator">
<span>Locator</span>
</label>
Run Code Online (Sandbox Code Playgroud)
如果里面有两个<span>元素,我希望第二个元素是红色的。有没有办法我只能为第二个指定选择器<span>?
我试过的是:
.inputWithLabel {
& > label span:last-child {
color: @alertColor;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果只有一个<span>,这是行不通的,因为第一个也只有<span>最后一个。
我有一个使用CSS的网格display: table;.
我想做的是在行之间留一个间隙.
我有办法在使用时做到这一点display: table-row;.我已经尝试了padding,margin但这些对我不起作用,因为我想设置边距背景颜色.
这是我的代码:
<ContentPage>
<ContentPage.Content>
<StackLayout Spacing="10" Margin="20">
<Label />
<Label />
<Label />
.....
<Label />
<Label />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
有很多标签,很多标签都会脱离屏幕的最后.但屏幕不会滚动.如何使其可滚动?
我看到了两者的建议,但想确认这是执行此操作的最佳方法:
public enum MO
{
Learn = 0,
Practice = 1,
Quiz = 2
}
public static partial class Extensions
{
public static MO ToMode(this string mode)
{
switch (mode)
{
case "Learn": return MO.Learn;
case "Practice": return MO.Practice;
case "Quiz": return MO.Quiz;
default: throw new InvalidEnumArgumentException("Unhandled value: " + mode.ToString());
}
}
}
Run Code Online (Sandbox Code Playgroud) asp.net ×3
css ×3
html ×3
sql-server ×3
c# ×2
angularjs ×1
http ×1
https ×1
web-services ×1
xamarin ×1