Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2007, 12:31 AM
Authorized User
 
Join Date: Dec 2006
Posts: 43
Thanks: 4
Thanked 0 Times in 0 Posts
Send a message via MSN to Yasho
Default sending date and time to access database

I need to send date and time to access database
I am using OLEDB adaptor
when i set field "date"=now it updates only date but not time in the database. What is the right command syntax

yvk
__________________
yvk
 
Old April 18th, 2007, 07:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

are you sure that you are not sending everything?? take in mind that sometimes access doesn't show all the data inside a field because of display issue... "now" should pass the date and time to the database... if not try adding a fixed date and time to see what happens...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
 
Old April 18th, 2007, 01:26 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Access delineates dates with pound signs in queries.
Are you opening a recordset and setting the value of that recordsets fields to Now(), or are you using a query with “UPDATE . . . ” or “INSERT INTO . . . ”?
 
Old May 24th, 2007, 12:59 AM
Authorized User
 
Join Date: Dec 2006
Posts: 43
Thanks: 4
Thanked 0 Times in 0 Posts
Send a message via MSN to Yasho
Default

here is the full code
I am still not successful in sending date and time , in Access
Database. Access database field for "mdate" is set to DataType = date/time and Format = GeneralDate
after update "mdate" has date but no time (example 5-23-07)
NOT( 5-23-07 1:07:00 AM))

      Dim newrow As dsLearnVB.costRow
        Dim main As New Form1

        TextBox1.Text = Now
        TextBox2.Text = 29.99

        Try
            newrow = DsLearnVB1.cost.NewRow
            main.newrow = newrow
            newrow("cost") = Val(TextBox2.Text)
            newrow("mdate") = FormatDateTime(Now, DateFormat.GeneralDate)
'and have also tried newrow("mdate") =system.convet.todatetime(textbox2.text)
            DsLearnVB1.Clear()
            DsLearnVB1.cost.Rows.Add(newrow)
            daLearnVB1.Update(DsLearnVB1)

        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString)
            newrow.CancelEdit()
        End Try


Additional Question
when cost field is set as data type number and format decimal
updates fills a value of 29.00 not 29.99
when i set the field to datatype double then it updates 29.99.
Can you explain this behavior too





yvk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Date time picker in access 2003... aboredman Access 1 August 9th, 2007 08:58 PM
Using "now()" to save date and time to database misskaos Classic ASP Basics 12 October 11th, 2006 05:01 PM
Convert Text to Date/Time in Access mmcdonal Access VBA 7 June 15th, 2004 12:19 PM
Sending Date variable into Oracle Database Judex Java Databases 1 September 20th, 2003 05:54 PM
Access begginer, how to autoenter time/date stompy Access 4 August 14th, 2003 09:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.