Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:24:39+00:00 2026-05-30T12:24:39+00:00

I am having problems with the following code: public class ClientGroupDetails { public DateTime

  • 0

I am having problems with the following code:

public class ClientGroupDetails
{
    public DateTime Col2;
    public String Col3;
    public Int32 Col4;

    public ClientGroupDetails(DateTime m_Col2, String m_Col3, Int32 m_Col4)
    {
        Col2 = m_Col2;
        Col3 = m_Col3;
        Col4 = m_Col4;
    }

    public ClientGroupDetails() { }
}

[WebMethod()]
public List<ClientGroupDetails> GetClientGroupDetails(string phrase)
{
    var client_group_details = new List<ClientGroupDetails>();

    using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"]))
    {
        using (command = new SqlCommand(@"select col2, col3, col4 from table1 where col1 = @strSearch", connection))
        {
            command.Parameters.Add("@strSearch", SqlDbType.VarChar, 255).Value = phrase;

            connection.Open();
            using (reader = command.ExecuteReader())
            {
                int Col2Index = reader.GetOrdinal("col2");
                int Col3Index = reader.GetOrdinal("col3");
                int Col4Index = reader.GetOrdinal("col4");

                while (reader.Read())
                {
                    client_group_details.Add(new ClientGroupDetails(
                        reader.IsDBNull(Col2Index) ? (Nullable<DateTime>)null : (Nullable<DateTime>)reader.GetDateTime(Col2Index),
                        reader.IsDBNull(Col3Index) ? null : reader.GetString(Col3Index),
                        reader.GetInt32(Col4Index)));
                }
            }
        }
    }

    return client_group_details;
}
}

It is giving me the following error:

Compiler Error Message: CS1502: The best overloaded method match for 'Conflicts.ClientGroupDetails.ClientGroupDetails(System.DateTime, string, int)' has some invalid arguments
Line 184: client_group_details.Add(new ClientGroupDetails(
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:24:41+00:00Added an answer on May 30, 2026 at 12:24 pm

    make m_Col2 DateTime? (Nullable<DateTime>)

    so finally it will be like this

    public class ClientGroupDetails
    {
        public Nullable<DateTime> Col2;
        public String Col3;
        public Int32 Col4;
    
        public ClientGroupDetails(Nullable<DateTime> m_Col2, String m_Col3, Int32 m_Col4)
        {
            Col2 = m_Col2;
            Col3 = m_Col3;
            Col4 = m_Col4;
        }
    
        public ClientGroupDetails() { }
    }
    
    [WebMethod()]
    public List<ClientGroupDetails> GetClientGroupDetails(string phrase)
    {
        var client_group_details = new List<ClientGroupDetails>();
        using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"]))
        {
            using (command = new SqlCommand(@"select col2, col3, col4 from table1 where col1 = @strSearch", connection))
            {
                command.Parameters.Add("@strSearch", SqlDbType.VarChar, 255).Value = phrase;
    
                connection.Open();
                using (reader = command.ExecuteReader())
                {
                    int Col2Index = reader.GetOrdinal("col2");
                    int Col3Index = reader.GetOrdinal("col3");
                    int Col4Index = reader.GetOrdinal("col4");
    
                    while (reader.Read())
                    {
                        client_group_details.Add(new ClientGroupDetails(
                            reader.IsDBNull(Col2Index) ? (Nullable<DateTime>)null : (Nullable<DateTime>)reader.GetDateTime(Col2Index),
                            reader.IsDBNull(Col3Index) ? (string)null : reader.GetString(Col3Index),
                            reader.GetInt32(Col4Index)));
                    }
                }
            }
        }
    
        return client_group_details;
    }
    }
    

    BTW: I’ll recommend you 1. to use properties in your POCO instead of public instance variables and give them meaningful names 2. use lowercase local variable names

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems with the following code: private class ClientPluginLoader : MarshalByRefObject {
I'm having problems implementing an asynchronous image loader to the following code. I read
I'm having problems with the following code. Serializing the object seems to work, but
I am having problems with template class specialization, see the code bellow, please. template
I'm having problems when trying to compile the following code: I first tried compiling
I'm having a problem getting a change event to register with the following code:
I'm having a problem with TRY...CATCH blocks. Can someone explain why the following code
I'm having a problem with image scaling. When I use the following code to
I'm having problems compiling the following program. I'm using gcc -framework Foundation inherit8.1m and
I am having problems with the following query in Castle ActiveRecord 2.12: var q

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.