Curtis Rutland's Profile User Rating: *****

Reputation: 4536 Guru
Group:
Moderators
Active Posts:
8,045 (5.01 per day)
Joined:
08-June 10
Profile Views:
73,728
Last Active:
User is online 2 minutes ago
Currently:
Viewing Board Index

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Chevrolet
Dream Kudos:
1000
Expert In:
C#, LINQ, Dynamics CRM 2011

Latest Visitors

Icon   Curtis Rutland has been promoted!

Posts I've Made

  1. In Topic: Using a DateTime field from a SQL Database

    Posted 30 Oct 2014

    Yes, there is a significantly neater (and safer) way to do that. Read this tutorial:

    http://www.dreaminco...ery-a-database/

    To boil it down, your update statement would look like this:

    UPDATE PayrollRuns SET IsProcessed = 'True' WHERE Date_Time_Triggered = @timeTriggered
    


    The idea is that you replace your actual values with "parameters". These act like SQL variables. You would then add a parameter to the command object, and provide the DateTime itself, not a string representation of the DateTime.

    Read through the tutorial and let me know if you still need help.

    P.S.: If you ever need a string representation of a date in a particular format, you can give a format string to the .ToString method. Try this out:

    var str = dateTimeTriggered.ToString("yyyy-MM-dd HH:mm:ss.fff");
    


    Then if you print str, you'll see the date in the correct format. Here's a link with all the formatting options:

    http://msdn.microsof...(v=vs.110).aspx
  2. In Topic: Name in code

    Posted 30 Oct 2014

    In the future, you can click the "Report" button located at the bottom left of any post. Include details about your request, and if it's within the rules, we'll do what we can to help.
  3. In Topic: Using a DateTime field from a SQL Database

    Posted 30 Oct 2014

    Well, I'm not sure what mechanism you're using for database access, but assuming that your databaseRow is a DataReader, getting something by index always returns an object, which you must cast to the correct type.

    Try this:

    DateTime date_Time_Triggered = (DateTime)databasesRow["Date_Time_Triggered"];
    


    That should work, if your column in the database is actually a DateTime column. If it's a varchar/nvarchar/char/nchar field, this simply will not work; you'd have to parse the date as a DateTime.

    But I'm assuming that it actually is a DateTime,because of your observed behavior. The default format of a DateTime's ToString does not include milliseconds. So even if you did get the date correctly, if you just look at it's ToString results, it will be missing the milliseconds part.

    If you want to see how to query databases more correctly (using parameters rather than string concatenation) check out the link in my signature. If you're unfamiliar with SQL Parameters, this is worth your time.
  4. In Topic: Adding The Value Of A Columns Digits To Get A Total With A ListView

    Posted 28 Oct 2014

    So...you've already got a loop. You've already got the code that pulls the "number" field. This line of code here is what I'm assuming pulls the number:

    string NumberVariable = node_of_node["Number"].InnerText;
    


    So, knowing that you can get each number, that's where you should be doing your summation. Outside the inner loop, you can create an int variable that will hold the sum. Set it to 0.

    Inside the loop, after you've grabbed your "NumberVariable" you can use the int.Parse method to convert that string to an integer. Add the result to your sum variable.

    Once you exit the inner loop, the sum variable will hold the total. Assign it to the label.

    Done.
  5. In Topic: Adding The Value Of A Columns Digits To Get A Total With A ListView

    Posted 28 Oct 2014

    We already have, several times. Don't try to go back into your ListView's items to calculate. You have to be adding these items to the ListView somehow. Use that data to calculate what the sum should be, then set the label value to that. You haven't shown us the code you use to add the items to the ListView, so it's hard to be more specific than that.

My Information

Member Title:
(╯□)╯︵ (~ .o.)~
Age:
30 years old
Birthday:
August 29, 1984
Gender:
Location:
San Antonio
Forum Leader:
C#
Full Name:
Curtis Rutland
Years Programming:
7
Programming Languages:
C# -- Forms, WPF, Silverlight, WCF

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://curtisrutland.com
Skype:
Skype  insertAlias_bytes
Twitter:
curtisrutland

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    NewRandomUsername Icon

    06 Jun 2014 - 20:59
    Did you get my messages(emails) sir?
  2. Photo

    BenignDesign Icon

    03 May 2013 - 13:29
    I see you were staring at my profile. I also stare randomly at profiles. We have much in common. We should probably hook up sometime. Just sayin.
  3. Photo

    eric wallace Icon

    31 Jan 2013 - 02:53
    can you help for visual basic
  4. Photo

    no2pencil Icon

    06 Dec 2012 - 08:34
    It still isn't good enough.
  5. Photo

    ikram002p Icon

    27 Jun 2012 - 10:51
    "It Doesn't Work!" That's not good enough!
    It Still Doesn't Work!.
    I didnt undestand it ??
  6. Photo

    tlhIn`toq Icon

    18 Mar 2012 - 11:22
    Congrats on breaking 3000
  7. Photo

    Curtis Rutland Icon

    08 Sep 2011 - 14:13
    "Leveling up." I like that!
  8. Photo

    MATTtheSEAHAWK Icon

    08 Sep 2011 - 13:55
    Yar ya see, i remember when yee wer purple!
    Anyways congrats! It's weird seeing people who've been one way so long "leveling up" :P.
  9. Photo

    Curtis Rutland Icon

    08 Sep 2011 - 12:59
    Thanks!
  10. Photo

    Sergio Tapia Icon

    08 Sep 2011 - 12:29
    Congrats on becoming a mod. :D
  11. Photo

    Ace26 Icon

    15 Jun 2011 - 13:39
    Hi mate, interesting to see we are age mates. Nice work you do in the forums.
    Just dropped by to say hi, anyways.
    Cheers.
  12. Photo

    RetardedGenius Icon

    20 Apr 2011 - 18:56
    Excellent C# tutorials, they've taught me a lot I didn't know. Please keep more of the good stuff coming! :D
  13. Photo

    Curtis Rutland Icon

    24 Mar 2011 - 14:55
    Yeah, felt like "professionalizing".
  14. Photo

    Dogstopper Icon

    23 Mar 2011 - 17:08
    Woah. Name switch! I took a double take...
  15. Photo

    CodingSup3rnatur@l-360 Icon

    01 Mar 2011 - 14:35
    No problem at all. Glad I could contribute :)
  • (2 Pages)
  • +
  • 1
  • 2