topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:08 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Stupid database date picker  (Read 5228 times)

chedabob

  • Participant
  • Joined in 2006
  • *
  • Posts: 34
  • C# Master (if only!!!)
    • View Profile
    • Donate to Member
Stupid database date picker
« on: January 17, 2007, 07:09 AM »
Right, so I have a date picker, for my database. The only problem is, despite the fact that the date is shown onscreen, its never passed into the database, unless the user clicks a value. See, its not normally a problem, but if the date selected is already correct, the average user won't change it. So then it doesn't go into the database, and when I search later, I can't find it, because there is no date.

So, is there an easy way to force the database to use the value shown onscreen?

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: Stupid database date picker
« Reply #1 on: January 17, 2007, 08:50 AM »
I'd love to help, but I have no clue what you doing. What language are you programming in? What tools are you developing in? How are you connecting to the database? etc.

chedabob

  • Participant
  • Joined in 2006
  • *
  • Posts: 34
  • C# Master (if only!!!)
    • View Profile
    • Donate to Member
Re: Stupid database date picker
« Reply #2 on: January 17, 2007, 09:33 AM »
Oops, forgot to mention.


Im using C#, in Visual C# Express 2005

I connected the database with the standard "Add data source" wizard.


tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: Stupid database date picker
« Reply #3 on: January 17, 2007, 04:46 PM »
In general terms there should be an event for when the data is being committed to the database. In that event check the value of the date field. If the value is null, then grab the value of the calendar control. Set the data field to the value of the calendar control.

Sorry, but I don't know C#, [ yet  ;) ], nor do I have Visual C# installed, so I can't be more specific than that presently. But the info I've provided should get you where you need to be.

chedabob

  • Participant
  • Joined in 2006
  • *
  • Posts: 34
  • C# Master (if only!!!)
    • View Profile
    • Donate to Member
Re: Stupid database date picker
« Reply #4 on: January 18, 2007, 03:32 PM »
Well, I found a default value setting with the TableAdaptor, but it throws a wobbler when I set it. Im gonna speak to my tutor at college, when it opens again (the roof blew off :O)