小编Day*_*yan的帖子

错误,在尝试ParseExact时间字符串时,字符串未被识别为有效的DateTime

执行突出显示的行后,以下操作失败.

在此输入图像描述

字符串未被识别为有效的DateTime.

它突然发生,在12点左右工作......?现在是下午4:54而且没有去.到底他妈发生了什么?

c# datetime

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

在C#中传递Asp.Net控件的DateTime的空值

我有一个TextBox持有日期的控件,通常可以null.我在插入中使用它,当我尝试插入时,我收到错误消息:

String was not recognized as a valid DateTime.

我不确定如何将null值作为日期时间传递.这是我的代码.

Convert.ToDateTime(txtDateAction.Text)是我遇到的问题.

protected void btnLog_Click(object sender, EventArgs e)
    {

            PhoneLogsBLL.InsertOCASPhoneCall(
            Convert.ToInt16(txtStaffID.Text), 
            Convert.ToDateTime(txtDate.Text),                
            chkAdvisoryBoard.Checked, 
            chkClaims.Checked, 
            chkDR.Checked, 
            chkEEOICPA.Checked, 
            chkOCAS.Checked, 
            chkPhysicianPanel.Checked, 
            chkPC.Checked, 
            chkWebsite.Checked, 
            chkSEC.Checked, 
            chkCATI.Checked, 
            chkNIOSH800.Checked, 
            chkORAU800.Checked, 
            chkCongressional.Checked, 
            chkCOI.Checked, 
            chkDOLOutreach.Checked, 
            txtDiscussion.Text, 
            chkActionRequired.Checked, 
            Convert.ToDateTime(txtDateAction.Text),
            txtAction.Text, 
            0, 
            chkActivityReport.Checked);
    } 

 public static void InsertOCASPhoneCall(
        short sintStaffID,
        DateTime dtmDateCalled,
        bool blnAB,
        bool blnClaims,
        bool blnDR,
        bool blnEEOICPA,
        bool blnOCAS,
        bool blnPhysicianPanel,
        bool blnPC,
        bool blnWebSite,
        bool blnSEC,
        bool blnCATI,
        bool blnNIOSH800,
        bool …
Run Code Online (Sandbox Code Playgroud)

c# asp.net datetime

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

AngularJS多个$ http调用,有多个结果

我有一个Id的列表,我希望所有人都能联系我的API.

我这样做的方式是这样的:

 var someFunct = function() {
      for (var i = 0; i < Apples.length; i++) {
       var Apple = Apples[i];
        $http.get("APIUrl" + Apple.Id).
        success(function (response) {
            for (var i = 0; i < response.Appleseeds.length; i++) {

                if(Apple.Appleseeds.Id == response.Appleseeds.Id)
                {
                    Apple.Size = response.Appleseeds.Size;
                }
            }               
        })

    }
Run Code Online (Sandbox Code Playgroud)

所以问题在于Apple[2]改变了价值,在哪里Apple[0]Apple[1]保持不变.response.Appleseeds拥有自己的Id列表.所以我需要改变所有应用程序的大小Apple[2].

javascript angularjs

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

如何从另一个列表中存在的结构列表中删除项目

public struct RegistryApp
{
    public string VendorName;
    public string Name;
    public string Version;
} 
Run Code Online (Sandbox Code Playgroud)

我有两个List<RegistryApp>用于保存Windows框中当前安装的所有应用程序.为什么两个?好吧,我有一个List来保存所有x86应用程序,一个用于保存所有x64应用程序.

List<RegistryApp> x64Apps64List = new List<RegistryApp>();
List<RegistryApp> x64Apps32List = new List<RegistryApp>();
Run Code Online (Sandbox Code Playgroud)

一旦这两个填充了从注册表中检索到的适当数据,我尝试以下操作以确保没有重复项.这种方法很有效,List<string>但没有合作List<RegistryApp>.

List<RegistryApp> ListOfAllAppsInstalled = new List<RegistryApp>();

IEnumerable<RegistryApp> x86Apps = x64Apps32List.Except(x64Apps64List);
IEnumerable<RegistryApp> x64Apps = x64Apps64List.Except(x64Apps32List);

foreach (RegistryApp regitem in x86Apps)
{
    if ((regitem.Name != null) && 
     (regitem.Name.Length > 2) && 
     (regitem.Name != "")) 
    {
        ListOfAllAppsInstalled.Add(regitem);
    }
}

foreach (RegistryApp regitem in x64Apps) 
{
    if ((regitem.Name != …
Run Code Online (Sandbox Code Playgroud)

c# collections duplicate-removal

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

之前的Erlang语法错误:'结束'

我最近开始学习erlang,但遇到了一个让我困惑的错误.

错误发生syntax error before: 'end' 在最后一行.我看过一些试图找到错误的例子,但我现在完全迷失了.有任何想法吗?

ChannelToJoin = list:keysearch(ChannelName,1,State#server_st.channels),
case ChannelToJoin of
    % Channel exists.
    {value, Tuple} ->
        if 
            %User is not a member of the channel
            not list:member(UserID, Tuple) ->
            %Add the user to the channel
            Tuple#channel.users = list:append(Tuple#channel.users, [UserID]);


            % If the user is already a member of the channel.
            true -> true
        end;
    %Channel doesn't exist
    false ->
        %Create new channel and add the user to it.
        NewState = State#server_st{channels = list:append(State#server_st.channels, NewChannel = #channel{name = …
Run Code Online (Sandbox Code Playgroud)

erlang

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

C#是否会在List &lt;Object&gt;上提前保留三个空实例?

我有以下几点:

 public static class LocalFileModelList
    {
        public static List<LocalFileModel> ModelList = new List<LocalFileModel>();
    }

    public class LocalFileModel
    {
        public string Name { get; set; }
        public string Extension { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

然后是一种从目录读取所有文件的方法。

public static List<LocalFileModel> GetAllFiles(string path)
{
    var files = Directory.GetFiles(path, "*.*");

    foreach(var file in files)
    {
        var Extension    = Path.GetExtension(file);
        var Filename     = Path.GetFileNameWithoutExtension(file);

        var model = new LocalFileModel
        {
            Name         = Filename,
            Extension    = Extension,
        };

        LocalFileModelList.ModelList.Add(model);     
    }

    return LocalFileModelList.ModelList;
}
Run Code Online (Sandbox Code Playgroud)

我注意到,在逐步执行代码时,当我创建的新实例时LocalFileModel,用数据填充它,然后将其添加到列表中。列表自动创建了另外三个类型为的实例null …

c# .net-3.5 windows-mobile-6.5 windows-embedded-compact

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