小编Dav*_*vid的帖子

C#Linq两个日期之间的日期

我正在尝试获取我的linq语句,以便在两个日期之间获取所有记录,而且我不太确定需要更改才能使其工作: (a.Start >= startDate && endDate)

var appointmentNoShow =
    from a in appointments
    from p in properties
    from c in clients
    where a.Id == p.OID && (a.Start.Date >= startDate.Date && endDate)
Run Code Online (Sandbox Code Playgroud)

c# linq

68
推荐指数
4
解决办法
24万
查看次数

替换字符串中的多个单词

我有多个单词我想用值替换,最好的方法是什么?

示例:这就是我所做的,但感觉和看起来都错了

string s ="Dear <Name>, your booking is confirmed for the <EventDate>";
string s1 = s.Replace("<Name>", client.FullName);
string s2 =s1.Replace("<EventDate>", event.EventDate.ToString());

txtMessage.Text = s2;
Run Code Online (Sandbox Code Playgroud)

一定有更好的方法?

谢谢

c#

20
推荐指数
3
解决办法
2万
查看次数

请求类型'System.Data.SqlClient.SqlClientPermission,System.Data,Version = 4.0.0.0的权限

我有一个WPF Web应用程序,我试图访问SQL 2000数据库,但我收到以下错误:

请求类型'System.Data.SqlClient.SqlClientPermission,System.Data,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败.

知道如何解决这个问题吗?我可能需要一个例子,因为我是新手,这是我的第一个WPF应用程序.

c# wpf

10
推荐指数
1
解决办法
2万
查看次数

目录安全

我的应用程序正在创建一个目录,以便我可以在其中存储日志文件.我正在为目录添加用户安全性,但我不知道如何使其传播.例如,我将用户添加everyone到目录中,并使用readwrite访问,但是当我的应用程序在此目录中创建日志文件时,日志文件未继承everyone安全性(读取,写入).

我错过了什么?

DirectorySecurity dirSec = Directory.GetAccessControl(_dbPath);
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.Write, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.ReadAndExecute, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.CreateFiles, AccessControlType.Allow));
Directory.SetAccessControl(_dbPath, dirSec);
Run Code Online (Sandbox Code Playgroud)

c# security directory-security

9
推荐指数
1
解决办法
9241
查看次数

Windows窗体 - 如何踢出单独的线程并保持当前线程

我有一个Windows应用程序和一个dll(Windows窗体),我试图打开(ActivationCheck),我试图暂停当前线程打开一个新线程(ActivationCheck)等待该窗体事件返回true然后继续主线程.有人可以解释\告诉我我做错了什么 - 谢谢.

 static class Program
    {
        private static SplashScreen splash;
        private static bool quitApp;
        private static bool activationFinished;

        [STAThread]
        static void Main()
        {

        Thread thread = new Thread(ActivationCheck);
        thread.Start();



               do
               {
                   Thread.Sleep(1000);
               } while (activationFinished);

           if (!quitApp)
           {


               Thread.Sleep(0);
              // WizardRun();
               Application.Run(new Main(ref splash));
             }
}
}

     private static void ActivationCheck()
        {

            splash.SetStatus = "Checking License...";

            Guid productId = new Guid(Properties.Settings.Default.ProductId);
            Guid versionId = new Guid(Properties.Settings.Default.VersionId);

            Client.UI.EntryPoint entryPoint = new EntryPoint();

            activationFinished = false;

            Client.BLL.ProductActivation.GenerateTrialLicense(productId1, versionId2, EditionId3);
            entryPoint.IniatePlugin(productId, versionId); …
Run Code Online (Sandbox Code Playgroud)

c# multithreading

2
推荐指数
1
解决办法
535
查看次数

"通过LinkBut​​ton下载.msi下载不允许访问此页面的HTTP动词"

我有一个asp.net Web应用程序,刚刚添加了一个允许用户下载的新链接

<asp:LinkButton ID="lnkDownload" runat="server" Text="Download" 
     PostBackUrl="/download/releases/program.msi" onclick="lnkDownload_Click" 
     ToolTip="Download">
</asp:LinkButton>
Run Code Online (Sandbox Code Playgroud)

但是,当我单击链接时,我收到HTTP错误405 - 不允许使用用于访问此页面的HTTP谓词.

我假设我需要更改IIS(IIS 6)中的某些设置,任何人都知道什么?

c# asp.net

1
推荐指数
1
解决办法
1457
查看次数

标签 统计

c# ×6

asp.net ×1

directory-security ×1

linq ×1

multithreading ×1

security ×1

wpf ×1