小编p.c*_*ell的帖子

在UTF-8中指定页面编码的好处?

将所有页面编码从UTF-8更改为ISO-8859-1有什么好处?

character-encoding

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

DriveInfo.DriveFormat上的设备未就绪错误

我有那个方法来检索NTFS的可移动设备信息:

    private void getdriverinfo()
    {
        // get the usb flash driver
        foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
        {
            if (driveInfo.DriveType == DriveType.Removable && driveInfo.DriveFormat.Equals("NTFS"))
            {
                comboBox1.Items.Add(driveInfo.Name);
            }
        }
        if (comboBox1.Items.Count == 0)
        {
            MessageBox.Show("No Removable Device Found , please plug in the USB drive and make sure it is in NTFS format and retry", "No Device Found!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        else if (comboBox1.Items.Count == 1)
        {
            comboBox1.Text = comboBox1.Items[0].ToString();
        }
        else
        {
            MessageBox.Show(comboBox1.Items.Count + " Removable Devices were found , please …
Run Code Online (Sandbox Code Playgroud)

c# driveinfo

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

使用包含&符号的URL将XML加载到XDocument

XDocument xd = XDocument.Load("http://www.google.com/ig/api?weather=vilnius&hl=lt");
Run Code Online (Sandbox Code Playgroud)

&调用Load()方法时,&符号不是包含URL的字符串中的受支持字符.发生此错误:

未处理XmlException:给定编码中的字符无效

如何将URL从URL加载到XDocument中,其中URL在查询字符串中有&符号?

c# linq-to-xml

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

这个SQL语句的问题

   $query="INSERT INTO `main_table` (`count`) VALUES ('$count') WHERE userid='$someid'";
Run Code Online (Sandbox Code Playgroud)

基本上我喜欢在main_table中将count的新值插入到变量count中,其中userid等于变量some​​id.

SQL抱怨此语句的语法.

mysql sql

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

传递列名作为参数?

有没有办法将列名作为参数传递给函数?

我想创建一个函数,我根据列过滤值,但我将此列名称传递给函数(理想情况下为字符串)?

我尝试过,但我将列名称声明为varchar,显然这不会起作用!

sql sql-server sql-server-2008

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

LINQ的左连接`join ... into`和`DefaultIfEmpty()`是如何工作的?

如何LINQ的join ... into.DefaultIfEmpty()合作,以表达左加入?

.DefaultIfEmpty()评估一次,还是n次?

c# linq

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

像Java一样在.NET中进行堆外存储?

.NET及其任何运行时(CLR,DLR)是否像Java一样支持堆外存储?

.net clr

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

启动 WCG 服务时出现 System.Configuration.ConfigurationErrorsException

此刻有些慌张。我正在尝试为客户安装软件更新,但不知何故我的 WCF 服务失败并给我一条我以前从未见过的错误消息。有没有人有任何想法?

日志名称:应用程序
来源:.NET 运行时
日期:2014-01-03 16:03:36
事件 ID:1026
任务类别:无
级别:错误
关键词:经典
用户:不适用
计算机:SERVER.NM.LOCAL
描述:
应用程序:MyApp.Web.Trading.WindowsServiceHost.exe
框架版本:v4.0.30319
描述:进程因未处理的异常而终止。
异常信息:System.Configuration.ConfigurationErrorsException
堆:
   在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
   在 System.Configuration.BaseConfigurationRecord.GetSection(System.String)
   在 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
   在 System.Configuration.ConfigurationManager.GetSection(System.String)
   在 System.ServiceModel.Activation.AspNetEnvironment.UnsafeGetSectionFromConfigurationManager(System.String)
   在 System.ServiceModel.Activation.AspNetEnvironment.UnsafeGetConfigurationSection(System.String)
   在 System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(System.Configuration.ContextInformation, System.String)
   在 System.ServiceModel.Description.ConfigLoader.LookupService(System.String)
   在 System.ServiceModel.ServiceHostBase.ApplyConfiguration()
   在 System.ServiceModel.ServiceHostBase.InitializeDescription(System.ServiceModel.UriSchemeKeyedCollection)
   在 System.ServiceModel.ServiceHost.InitializeDescription(System.Type, System.ServiceModel.UriSchemeKeyedCollection)
   在 System.ServiceModel.ServiceHost..ctor(System.Type, System.Uri[])
   在 MyApp.Web.Trading.ServiceImplementations.Wcf.Start()
   在 System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   在 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   在 System.Threading.ThreadHelper.ThreadStart()

.net wcf

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

是否存在依赖于.NET Culture的"今日"字符串?

我正在编写一个月历式控件,需要显示一个表示今天日期的字符串.所以在英国文化机器上它会显示出来'Today : 11/02/2009'.

如果恰好使用了不同的文化,比如法语,那么我想用法语单词"今天".

.NET平台是否将此单词作为文化信息的一部分公开,以便我可以自动检索它?我找不到任何暴露但也许我找不到合适的地方.

.net c# datetime monthcalendar

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

Assembly的App.Config被忽略了; 正在读取Machine.config

在针对我的DAL 运行VS2008 单元集成测试时,我发现程序集正在读取machine.config而不是程序集app.config.

这是调用堆栈的纲要:

  • 单元测试项目具有调用DataLayer项目的方法
  • MyDataLayerclass继承自基类.调用方法GetStuff()
  • 基类正在使用System.Configuration.都好.
  • 在代码中调用此属性:ConfigurationManager.ConnectionStrings["MyConnStr"]实际上返回null,因为它显然没有找到.
  • 检查 MyDataLayer班级,是的,MyConnStr就在那里.
  • 检查集合ConnectionStrings,是的,它有一个连接字符串.它是machine.config中的那个C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config
  • 我不确定为什么我的DAL app.config被它取代了machine.config

任何帮助表示赞赏!

c# configuration unit-testing app-config visual-studio

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