locked
Update date to the database RRS feed

  • Question

  • User-1385731963 posted

    Hello Guys! I was just wondering as to how i could update the date field to the database. I have extracted the day, and the month from the date entered.
    date entered : 06/03/09
    for eg: atmonth = June
                atday = 3
    My database has got fields like the following
    month 1  2    3   4    5   6   7    8 ...

    I can easily store the month filed. But having a problem storing the day as i need to enter the value corresponding to the day number
    For eg:
    month 1  2    3   4    5   6   7    8 ...
    June             P

    I'm not sure if this is possible or not. Please i need your help on this. If someone could write a sample query on how this could be accomplished.
    I hope i'm clear. Please let me know if u need any clarification.

    Thanks in advance

    Thursday, June 4, 2009 5:39 AM

Answers

  • User-821857111 posted

    My database has got fields like the following
    month 1  2    3   4    5   6   7    8 ...
     

    What usually happens is that people would use a straightforward DATETIME type for their date fileds, and then construct a valid date from the values that users select from Dropdowns for the Day, Month and Year, or better still, you can use a Javascript date picker or calendar for people to enter a valid date into the web form.  The rest is easy:  http://www.mikesdotnetting.com/Article.aspx?ArticleID=92

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 5, 2009 2:21 AM

All replies

  • User1611433984 posted

    Hi

    We dont Exactly get you.. could you please make it clear what you really wanna do and the problem that you are facing

    Thursday, June 4, 2009 7:43 AM
  • User567712859 posted

    persuming that you have datetime data field in data base

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

     

    ALTER PROCEDURE [dbo].[pt_proc_obsClientProducts_UpdateAdminSideLicensesAccept]

    (

    @ID int,

    @AdditionalLicenses tinyint = NULL,

    @MoreAddLicenses tinyint = NULL,

    @AddLicensesReq tinyint = NULL,

    @ModDate datetime = NULL

    )

    AS

    BEGIN

    SET NOCOUNT OFF

    DECLARE @Err int

    UPDATE [obsClientProducts]

    SET

    [AdditionalLicenses]= @AdditionalLicenses,

    [MoreAddLicenses ]= @MoreAddLicenses ,

    [AddLicensesReq]= @AddLicensesReq,

    [ModDate] = @ModDate

    WHERE

    [ID] = @ID

    SET @Err = @@Error

     

    RETURN @Err

    END

     

    if you find your ans then do mark my as asnwer

    Thursday, June 4, 2009 8:04 AM
  • User-1199946673 posted

    Applepie, you seem to understand what the question is, however like Jacobodolil I really don't have a glue what exactly the problem is, nor do I see how you answer would be the answer to the question, especially since this is an Access forum and your example is an SQL Server Stored Procedure....

    Thursday, June 4, 2009 10:32 AM
  • User-1385731963 posted

    I'm sorry guys, I have dropped this database design. Now going for a different one. Thnks for your patience and time.

    Thursday, June 4, 2009 11:12 AM
  • User-821857111 posted

    My database has got fields like the following
    month 1  2    3   4    5   6   7    8 ...
     

    What usually happens is that people would use a straightforward DATETIME type for their date fileds, and then construct a valid date from the values that users select from Dropdowns for the Day, Month and Year, or better still, you can use a Javascript date picker or calendar for people to enter a valid date into the web form.  The rest is easy:  http://www.mikesdotnetting.com/Article.aspx?ArticleID=92

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 5, 2009 2:21 AM