Insert date into sql server database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somtabu
    New Member
    • Nov 2006
    • 15

    Insert date into sql server database

    I have a problem. The problem is............. .....

    In vb.net, there is a form with a Datetimepicker. in the database(sql server) there is a field with a DateTime data type. now I want to send date from the form to database..... Please help me.....
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by somtabu
    I have a problem. The problem is............. .....

    In vb.net, there is a form with a Datetimepicker. in the database(sql server) there is a field with a DateTime data type. now I want to send date from the form to database..... Please help me.....
    have you tried anything....hav e you written any sql insert statement.....g ive us the code.....insert ing date is very simple.......

    if you need some idea of how to write sql then serach in net........

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      You need to capture the date from the picker control and pass the same to database using SQL statment . You might have to convert to proper format before inserting.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        If your database has a Date/Time column (we'll call it say "EntryDate" )
        If you are building your SQL statement as a direct string, you can use the single quote ' around a .ToString() on your DateTime object in VB.NET and the database will understand it.

        If you are using a stored procedure, you can set the parameter type to be DateTime and then set it's value to be the DateTime object itself.

        Comment

        Working...