我不断收到错误无法联系服务器。当我尝试运行我的代码时:
我已经搜索了几个小时,但仍然无法联系服务器。
DirectorySearcher directorySearcher = new DirectorySearcher();
string path = directorySearcher.SearchRoot.Path;
DirectoryEntry directoryEntry = new DirectoryEntry(path);
PrincipalContext pricipalContext = new PrincipalContext(ContextType.Domain, "LDAP://domain.dk/DC=domain,DC=dk");
//GroupPrincipal group = GroupPrincipal.FindByIdentity(pricipalContext, "(CN=" + department + ")");
GroupPrincipal group = GroupPrincipal.FindByIdentity(pricipalContext, "(CN=" + department + ")");
if (group != null)
{
foreach (Principal principal in group.Members)
{
UserPrincipal tu = principal as UserPrincipal;
DirectoryEntry de = tu.GetUnderlyingObject() as DirectoryEntry;
var store = de.InvokeGet("physicalDeliveryOfficeName").ToString();
var storeNumber = de.InvokeGet("description").ToString();
employees.Add(new AdEmployees() { name = principal.Name, phone …
Run Code Online (Sandbox Code Playgroud) c# ldap active-directory windows-authentication directorysearcher
我的桌子上有一个复选框.这是该复选框的CSS
input[type="checkbox"] {
width: 20px;
height: 30px;
margin: auto;
display: table-row;
border: 5px solid red;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
margin-left: 4px;
margin-top: 1px;
}
Run Code Online (Sandbox Code Playgroud)
但它显示正常的复选框.我想更改该复选框的边框颜色.但它不起作用!
我需要将生成的随机数从JS函数传递给html div,但是它无法传递它,这是我的代码片段
<html>
<head>
</head>
<body>
<button id="order" onclick="getRand()">orderId</button>
<div id="order_id"></div>
<script>
var getRand = function () {
var elem = Math.floor(Math.random() * 89999 + 10000);
document.getElementById("order_id").innerHTML = elem.value;
};
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在尝试将用户输入的值/文本从文本框添加到我的数据库中.
目前我无法获取将值插入sqldatabase的代码.
这是我的aspx代码
<asp:TextBox ID="txt_WineName" runat="server" PlaceHolder="WineName" />
<asp:TextBox ID="txt_WineYear" runat="server" PlaceHolder="WineYear" />
<asp:TextBox ID="txt_WinePrice" runat="server" PlaceHolder="WinePrice" />
<asp:TextBox ID="txt_WineType" runat="server" PlaceHolder="WineType" />
<asp:Button ID="btn_AddWine" runat="server" Text="Add" />
Run Code Online (Sandbox Code Playgroud)
这是我的C#代码:
protected void btn_AddWine(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection("Data Source=PCM13812;Initial Catalog=Kronhjorten;Integrated Security=True"))
{
connection.Open();
string query = "SELECT * FROM Wines";
using (SqlCommand command = new SqlCommand(query, connection))
{
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
string Name = txt_WineName.Text;
string Year = txt_WineYear.Text;
string …
Run Code Online (Sandbox Code Playgroud) 您好,感谢您的阅读.
我正在尝试将当前日期插入到我的表中,但我无法弄清楚如何正确编写它.
这是我的C#代码:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);
conn.Open();
string Comment = UserWriteComment.Text;
string ID = DetailedID.Text;
string Name = DetailedName.Text;
string UniqueID = lblID.Text;
string query = "INSERT INTO Comment(TicketID, Name, Comments, UserID, Date)" + "Values('" + ID + "', '" + Name + "', '" + Comment + "', '" + UniqueID + "', '" + Date + "')";
using (SqlCommand com = new SqlCommand(query, conn))
{
com.ExecuteNonQuery();
UserWriteComment.Text = "";
}
Run Code Online (Sandbox Code Playgroud)
在Query中,有一个名为Date的值.这是我喜欢将当前日期传递到我的表中的函数.
我希望你能帮助我,因为我没有设法找到答案.
谢谢:)
我按信息ID和ANCHOR选择值:
SELECT
infoid,
anchor,
value
FROM
infodata
WHERE
(infoid = 1)
OR (infoid = 2)
OR (infoid = 3)
ORDER BY
anchor ASC
Run Code Online (Sandbox Code Playgroud)
此查询返回一个infoid,anchors和数字列表:
infoid anchor value
------ ----- -----
1 10 500
2 10 600
3 10 700
1 20 800
2 20 900
3 20 1000
Run Code Online (Sandbox Code Playgroud)
我如何通过ANCHOR GROUP并返回3个infos的SUM()值?返回这样的东西:
anchor value
----- -----
10 500+600+700
20 800+900+1000
Run Code Online (Sandbox Code Playgroud) 我想通过使用任何列(例如“标题”或“开始日期”或“可见”等)在此表中进行过滤或搜索,现在我的代码通过第一个列“标题”进行搜索,但我无法使其在所有列 https://datatables 中进行搜索。 net/examples/data_sources/dom.html这正是我想要的
<div>
<label>
Search:<input type="text" id="Search" onkeyup="myFunction()" placeholder="search for performance">
</label>
</div>
<table id="PerformanceTable" class="table table-bordered table-striped">
<tr>
<th>
Title
</th>
<th>
Start Date
</th>
<th>
Booking
</th>
<th>
Visible
</th>
<th>
Featured
</th>
<th>
Event
</th>
<th>
@Html.DisplayNameFor(model => model.Views)
</th>
<th></th>
</tr>
</table>
<script>
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("Search");
filter = input.value.toUpperCase();
table = document.getElementById("PerformanceTable");
tr = table.getElementsByTagName("tr");
// Loop through all table …
Run Code Online (Sandbox Code Playgroud) 我正在使用此处提供的intlTelInput的演示代码
我可以使用以下方法获取拨号代码
var intlNumber = $("#phone").intlTelInput("getSelectedCountryData");
Run Code Online (Sandbox Code Playgroud)
但是我无法从#phone文本框中获取完整的号码,即“用户输入的拨号代码+号码”。
我的DropDownList有问题.在阅读了很多帖子后,我仍然无法让它工作如此恶心.
这是我的C#代码:
protected void Page_Load(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection("Data Source=PCM13812;Initial Catalog=Newsletter;Integrated Security=True"))
{
connection.Open();
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand("Select Email From Newsletter", connection);
EmailList.DataSource = cmd.ExecuteReader();
EmailList.DataTextField = "Email";
EmailList.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Vælg_Click(object sender, EventArgs e)
{
EmailListe .Text = EmailList.Text;
}
Run Code Online (Sandbox Code Playgroud)
这是我的Asp代码:
<asp:DropDownList ID="EmailList" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList>
<asp:Button runat="server" ID="Vælg" Text="Vælg Email" OnClick="Vælg_Click" />
<asp:TextBox runat="server" ID="EmailListe" TextMode="MultiLine" />
<asp:TextBox …
Run Code Online (Sandbox Code Playgroud) 我想做的是比较DateTime变量和sql server表中的日期,如果这两个日期之间的差异小于30分钟,则select查询将返回一些值,我正在使用c#发送DateTime变量
string query = "Select * from LoginAttempts where IP_ADDRESS='" + Ipadress + "' and ATTEMPTS<"+MaxLoginAttempts+" and (GETDATE()-LOGIN_DATE)<30";
Run Code Online (Sandbox Code Playgroud)
and (GETDATE()-LOGIN_DATE)<30
我知道这是一个错误的陈述,但应该如何解决?
我试图多次使用Timeout函数,但它只运行一次.我试图在6秒后获得第二个URL.
3秒后的第一个,这是正常的.还试过if else声明但没有效果.
<!doctype html>
<html>
<body>
<p>You will be redirected in 3 seconds</p>
<script>
var time = setTimeout(function () {
window.location = 'http://example.com'
}, 3000);
var one = setTimeout(function () {
window.location = 'http://google.com'
}, 6000);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 当我在textarea中输入第一个字符时,它仍显示0,而第二个字符的count则为1.不知道为什么?我正在使用keydown事件.
$(".textArea").keydown(updateCount());
function updateCount() {
count = $(".textArea").val().length;
this.$countDiv.text(count + " of 240");
};
Run Code Online (Sandbox Code Playgroud) c# ×5
javascript ×5
sql ×5
html ×3
jquery ×3
asp.net ×2
checkbox ×1
css ×1
datetime ×1
dom ×1
html-select ×1
ldap ×1
mysql ×1
sql-server ×1
textarea ×1