Hi,
i would like to know to retrieve out the date and time from my database to show on the wcf test client and for eg, after choosing a certain date, how to do the coding in order for the events to show that's happening on the date i choose or after the date ? Please help me. Thank-you.

It's sth like this but still facing some error.

 public List<EventEntity> GetCurrentUpComingEvents(string uid)
        {
            EventDBModelDataContext context = new EventDBModelDataContext();
            var res = from e in context.EventEntities where e.eventDate == >= date select e;
               return res.ToList();
        }

Recommended Answers

All 7 Replies

I didnt actually get you completely.
Would you like to rise an event when you choose some date?

Please clarify it a bit better.
thx

You need to separate your comparison clauses

public List<EventEntity> GetCurrentUpComingEvents(string uid)
{
    EventDBModelDataContext context = new EventDBModelDataContext();
    var res = from e in context.EventEntities
              where e.eventDate == date || e.eventDate >= date
              select e;
    return res.ToList();
}

The || in between there means "OR" it's the same that you would use in an "if" statement if(e.eventDate == date || e.eventDate >= date) To be perfectly honest, you do not need the "==" as ">=" means "greater than or equal to". But I've left it in as I thought it would be better you understand the comparison operators.

I didnt actually get you completely.
Would you like to rise an event when you choose some date?

Please clarify it a bit better.
thx

Hi, for example;
i key in this id- 06Aug2011_0001 from my database when i test out my project in wcf test client then given the id that i choose, they will list out all the events on that date or after that date. May i know how do i go abt it with the coding ?

hai

could u please

i need to know that when i add a data in a textbox i just want to sea it from the date time picker(c#.net)
if one of u helpme to it it willbe very thankfull

Sorry, but from your english I cannot get the appropriate question.
Sorry, I cannot help you out with anything yet.

Ok, this is following on from a PM you sent me.

So, somewhere in your application you are asking for a date yes?

You need to pass this date to your search function. The reason it doesn't work is because "date" has no definition in your method.

So say you call this method from a form, you might want to change your method signature to: public List<EventEntity> GetCurrentUpComingEvents(string uid, DateTime date) Pass the date you've just recorded from the user, to this method.

Thanks katsuekiame so much for your help! Managed to solved it alr. (:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.