有人可以告诉我一些用于查询xml文件的TSQL,就好像它是一个表吗?
该文件位于服务器上,"C:\ xmlfile.xml"
并包含
<ArrayOfSpangemansFilter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SpangemansFilter>
<FilterID>1219</FilterID>
<Name>Fred</Name>
<Code>510</Code>
<Department>N</Department>
<Number>305327</Number>
</SpangemansFilter>
<SpangemansFilter>
<FilterID>3578</FilterID>
<Name>Gary</Name>
<Code>001</Code>
<Department>B</Department>
<Number>0692690</Number>
</SpangemansFilter>
<SpangemansFilter>
<FilterID>3579</FilterID>
<Name>George</Name>
<Code>001</Code>
<Department>X</Department>
<Number>35933</Number>
</SpangemansFilter>
</ArrayOfSpangemansFilter>
Run Code Online (Sandbox Code Playgroud)
我之后输出的示例
FilterID |Name |Code |Department |Number
-------------------------------------------------------------------
1219 |Fred |510 |N |305327
3578 |Gary |001 |B |0692690
3579 |George |001 |X |35933
Run Code Online (Sandbox Code Playgroud) 在我的应用程序的Asp.Net Identity Auth中间件设置中我有
app.UseCookieAuthentication(new CookieAuthenticationOptions {
LoginPath = new PathString("/Login/"),
//AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
Provider = new CookieAuthenticationProvider {
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MyUserManager, MyUser>(
TimeSpan.FromMinutes(30),
(manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie)
),
},
});
Run Code Online (Sandbox Code Playgroud)
我从另一个应用程序复制了这个,我只是注意到如果我取消注释该AuthenticationType
行,登录成功(我从我的控制器写入的记录器中获得成功消息)但总是重定向回登录屏幕.
在CookieAuthenticationOptions的文档中说
选项中的AuthenticationType对应于IIdentity AuthenticationType属性.可以分配不同的值,以便在管道中多次使用相同的身份验证中间件类型.(继承自AuthenticationOptions.)
我真的不明白这是什么意思,为什么会导致我的登录请求被重定向(成功登录后,不会少),也没有人知道这个选项会是有用的.
我想知道是否有标准代码可以使用密钥生成 SHA256 哈希值。我遇到过几种类型的代码,但是它们不会生成相同的输出。
在JokeCamp找到的代码
private string CreateToken(string message, string secret)
{
secret = secret ?? "";
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
return Convert.ToBase64String(hashmessage);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我找到的另一张
private static string ComputeHash(string apiKey, string message)
{
var key = Encoding.UTF8.GetBytes(apiKey);
string hashString;
using (var hmac = new HMACSHA256(key))
{
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(message));
hashString = Convert.ToBase64String(hash);
}
return hashString;
}
Run Code Online (Sandbox Code Playgroud)
这两个生成的代码与http://www.freeformatter.com/hmac-generator.html#ad-output生成的代码不同 …
我怎样才能在列表中添加新项目?
这是我的对象列表或任何人称之为
class WordListsAll
{
public int idAll { get; set; }
public string wordEnAll { get; set; }
public string translationAll { get; set; }
public List<string> videosOfSelectedWord { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想要的是向videosOfSelectedWord列表属性添加一个新项目.
这样做的最佳方式是什么?
foreach (var item in q)
{
count++;
oWordListsAll.Add(new WordListsAll
{
idAll = count,
wordEnAll = item.Element("Word").Value,
translationAll = item.Element("Translation").Value,
///////////////here is my goal///////////////////
videosOfSelectedWord.Add(myCustomString)
});
}
Run Code Online (Sandbox Code Playgroud)
有时我想回来并为之前创建的实例添加一个新的myCustomString.Imagin有一个单词"hello",视频名称为"Dexter",并且还有一个单词"hello",但这次的视频名称为"Breaking Bad".
如何将这些视频名称添加到我的视频属性列表中?OfSelectedWord?
所以我做了一些使用以下css代码的页面:
html { overflow-y: scroll; }
ul.navbar {
list-style-type: none;
position: fixed;
top: 00px;
left: 00px;
width: 200px;
height: 700px;
background-image:url('/images/B_left-background.png');
}
ul.header {
position: fixed;
top: -20px;
left: 240px;
height: 100px;
width:700px;
background-image:url('/images/B_left-top.png');
}
body {
position: fixed;
top: 100px;
left: 300px;
font-family: Georgia, "Times New Roman",
Times, serif;
background-color: #D6E9B4;
}
div.scrollableContainer {
background: none repeat scroll 0 0 ;
border: 1px solid #999999;
height: 400px;
margin: 40px;
overflow: auto;
width: 800px;
}
h1 {font-family: Helvetica, Geneva, Arial, …
Run Code Online (Sandbox Code Playgroud) 如何在C#中使用ESC/POS命令?我需要这样的格式
但我无法实现这种格式.我尝试了一些代码,但没用.
using (var ms = new MemoryStream())
using (var bw = new BinaryWriter(ms))
{
// Reset the printer bws (NV images are not cleared)
bw.Write(AsciiControlChars.Escape);
bw.Write('@');
bw.Write(AsciiControlChars.Newline);
bw.Write(AsciiControlChars.Escape);
bw.Write("_______________________________________________");
bw.Write(AsciiControlChars.Newline);
bw.Write("Service Price Qty Total");
bw.Write("------------------------------------------------");
bw.Write(AsciiControlChars.GroupSeparator);
bw.Write('V');
bw.Write((byte)66);
bw.Write((byte)3);
bw.Flush();
// Send the converted ANSI string to the printer.
}
Run Code Online (Sandbox Code Playgroud) SELECT * FROM dbo.Calendars WHERE calname NOT IN(NULL)
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么总是NOT IN(NULL)什么都不返回?
PS:无论你的表是什么,如果你将NOT IN(NULL)添加到任何列的条件,结果都没有.先感谢您 :)