Results 1 to 2 of 2

Thread: String Format

  1. #1
    Join Date
    Aug 2007

    Unanswered: String Format

    Hi Everybody,
    Can anybody rewrite this string as a single string of code without been broken into two as I have now:

    string todayAsWhereClause = string.Format("DeviceName LIKE 'Time and Attendance %' AND EventTime between '{0:yyyy-MM-dd} 06:00:00'", DateTime.Today.AddMonths(0).AddDays(-37)) + string.Format("and '{0:yyyy-MM-dd} 07:30:00'", DateTime.Today.AddMonths(0).AddDays(-7));

    Note that it works perfectly as it is, I don't just want to have + string.Format in between the code, please tell me the principle that guide the answer you offered me. Thanks, Dapo.

  2. #2
    Join Date
    Nov 2002
    you do know this is a sql server forum...right?

    and in any case you should be using sprocs

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts