小编dc.*_*dc.的帖子

保护app.config - VB.Net 3.5

我正在使用Visual Studio 2008 Pro创建VB Winform应用程序.我的app.config文件中有一些自定义配置设置以及MS SQL连接字符串.

  1. 确保没有人可以在app.config中读取这些设置的最佳方法是什么?
  2. 是否有任何其他区域的纯文本连接字符串,我可能也想考虑保护?

谢谢!

.net vb.net winforms

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

从文本字符串创建日期 - VB.Net

我在将字符串转换为我需要的日期格式时遇到问题.我试图转换的字符串的一个例子是215056081909.我想将该字符串转换为08/19/09 21:50:56.

下面列出的代码是我尝试用于转换过程的代码.当我运行代码时,我收到下面的错误,我很确定这是因为我的字符串在军事(24小时)时间内有时间部分.任何人都可以帮我把字符串转换成我需要的格式吗?

谢谢!

Error:
System.ArgumentOutOfRangeException was unhandled
      Message="Index and length must refer to a location within the string. Parameter name: length"
      ParamName="length"
      Source="mscorlib"
      StackTrace:
           at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
           at System.String.Substring(Int32 startIndex, Int32 length)
           at GLTracker.PortManager.DoDataCollection(MessageType type, String msg)
           at GLTracker.PortManager.comPort_DataReceived(Object sender, SerialDataReceivedEventArgs e)
           at System.IO.Ports.SerialPort.CatchReceivedEvents(Object src, SerialDataReceivedEventArgs e)
           at System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents(Object state)
           at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
           at System.Threading.ExecutionContext.runTryCode(Object userData)
           at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, …
Run Code Online (Sandbox Code Playgroud)

vb.net datetime

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

标签 统计

vb.net ×2

.net ×1

datetime ×1

winforms ×1