我有那个方法来检索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) 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在查询字符串中有&符号?
$query="INSERT INTO `main_table` (`count`) VALUES ('$count') WHERE userid='$someid'";
Run Code Online (Sandbox Code Playgroud)
基本上我喜欢在main_table中将count的新值插入到变量count中,其中userid等于变量someid.
SQL抱怨此语句的语法.
有没有办法将列名作为参数传递给函数?
我想创建一个函数,我根据列过滤值,但我将此列名称传递给函数(理想情况下为字符串)?
我尝试过,但我将列名称声明为varchar,显然这不会起作用!
如何LINQ的join ... into和.DefaultIfEmpty()合作,以表达左加入?
是.DefaultIfEmpty()评估一次,还是n次?
此刻有些慌张。我正在尝试为客户安装软件更新,但不知何故我的 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()
我正在编写一个月历式控件,需要显示一个表示今天日期的字符串.所以在英国文化机器上它会显示出来'Today : 11/02/2009'.
如果恰好使用了不同的文化,比如法语,那么我想用法语单词"今天".
.NET平台是否将此单词作为文化信息的一部分公开,以便我可以自动检索它?我找不到任何暴露但也许我找不到合适的地方.
在针对我的DAL 运行VS2008 单元集成测试时,我发现程序集正在读取machine.config而不是程序集app.config.
这是调用堆栈的纲要:
MyDataLayerclass继承自基类.调用方法GetStuff()System.Configuration.都好.ConfigurationManager.ConnectionStrings["MyConnStr"]实际上返回null,因为它显然没有找到.MyDataLayer班级,是的,MyConnStr就在那里.ConnectionStrings,是的,它有一个连接字符串.它是machine.config中的那个C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.configapp.config被它取代了machine.config任何帮助表示赞赏!
c# ×5
.net ×3
sql ×2
app-config ×1
clr ×1
datetime ×1
driveinfo ×1
linq ×1
linq-to-xml ×1
mysql ×1
sql-server ×1
unit-testing ×1
wcf ×1