小编620*_*2SP的帖子

无法写入注册表项

当我试图在注册表中保存我的密钥时,我收到错误无法写入注册表项.

//这是我的代码

注意:我尝试以管理员身份运行,假设某些权限问题仍然出现同样的错误....

private const string RegistryKeyName = "Skms";
private readonly RegistryKey SoftwareKey = Registry.LocalMachine.OpenSubKey("SOFTWARE");

public KeyManagementRegistryKeyChangeImpl(bool writeable)
    {
        this.writable = writeable;
        RegistryKey skms; 
        if (Environment.Is64BitOperatingSystem == true) 
        {
            skms = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(RegistryKeyName,true);

        }
        else
        {
            skms = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
        }

        if (null == skms)
        {
            skms = SoftwareKey.CreateSubKey(RegistryKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree);
        }

        if(skms == null)
        {
            throw new System.ArgumentException(string.Format(CultureInfo.InvariantCulture, 
                @"Registry Key 'HKEY_LOCAL_MACHINE\SOFTWARE\{0}' not found or created",
                RegistryKeyName));
        }

        Decryptor decryptor = Decryptor.Create();
Run Code Online (Sandbox Code Playgroud)

c#

32
推荐指数
3
解决办法
4万
查看次数

将Datagridview值更新到数据库中

我正在开发一个表单应用程序,用户可以从数据库中获取表格数据到gridviewcontrol,这是可编辑的,这样用户可以更新网格中的一些数据,当用户点击表单时更新按钮,更新的数据网格值应该在数据库中更新.用户可以一次更新更多列值.我正在研究数据网格的第一时间,我设法从数据库中获取数据并在数据网格中显示,但我无法更新编辑数据返回顶级数据库.

c#

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

jquery.lazyload.js插件下载

我想下载jquery.lazyload.js插件,请指导我从哪里下载这个插件?我正在尝试实现延迟加载,当我在线搜索时,我发现我们需要这个插件.

jquery-plugins

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

删除文本文件中的行

嗨,当用户检查不需要架构时,我有一个包含表模式和数据的文本文件,然后我需要删除模式并保留数据.我正在使用StreamReader读取文件并检查一个条件,它应该删除文件中的所有行,直到它满足我的条件.如果我正在检查,请说

  using (StreamReader tsr = new StreamReader(targetFilePath))
        {
            do
            {
                string textLine = tsr.ReadLine() + "\r\n";

                {
                    if (textLine.StartsWith("INSERT INTO"))
                    {

                         // It should leave these lines 
                        // and no need to delete lines 
                    }

                    else
                    {
                      // it should delete the lines 
                    }

                }
            }
            while (tsr.Peek() != -1);
            tsr.Close();  
Run Code Online (Sandbox Code Playgroud)

请建议我如何删除行,并注意如果textline找到"InsertInto",它不应该从那里删除任何内容.

c#

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

标签 统计

c# ×3

jquery-plugins ×1