Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Using Date Datatype in Access 2000 from Form


Message #1 by steveproctor@c... on Sun, 4 Aug 2002 19:48:13
How do you add a date field to an Access table, both using actual values 
and parameters? 

Suppose I have two values, Initials and Date. I've tried the following 
without success: 

"INSERT INTO TABLE ( Initials, Date ) VALUES ( 'AAA', #7/27/2002# )" 

But eventually, I want to capture form inputs for the date using 
parameters.  I'm having trouble with this also.

Capturing the form data, I've been using 

dtDate = txtDate.Text 
cmdInsert.Parameters.Add( "@Date", OleDbType.Date ).Value = dtDate 
"INSERT INTO TABLE ( Initials, Date ) VALUES ( @Initials, @Date )" 

Any help is greatly appreciated. 

Steve 
Message #2 by "Hovik Melkomian" <melvik@b...> on Mon, 5 Aug 2002 10:05:36 +0430
I had problem with Date/Time  then I used text.
i'll happy to get it.

Hovik.

----- Original Message -----
From: <steveproctor@c...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Sunday, August 04, 2002 7:48 PM
Subject: [aspx_beginners] Using Date Datatype in Access 2000 from Form


How do you add a date field to an Access table, both using actual values
and parameters?

Suppose I have two values, Initials and Date. I've tried the following
without success:

"INSERT INTO TABLE ( Initials, Date ) VALUES ( 'AAA', #7/27/2002# )"

But eventually, I want to capture form inputs for the date using
parameters.  I'm having trouble with this also.

Capturing the form data, I've been using

dtDate = txtDate.Text
cmdInsert.Parameters.Add( "@Date", OleDbType.Date ).Value = dtDate
"INSERT INTO TABLE ( Initials, Date ) VALUES ( @Initials, @Date )"

Any help is greatly appreciated.

Steve


Message #3 by steveproctor@c... on Thu, 8 Aug 2002 15:21:09
Dear Hovik:

Thank you for your answer.  It is certainly a practical approach.  But 
there has to be a way that uses the date data type.  I have tried every 
variation I can think of to use VB.NET to insert a date into a database 
(in this case Access 2000) with date data type and I only get syntax 
errors.  Does anyone else have a solution?

Steve

> I had problem with Date/Time  then I used text.
i'll happy to get it.

Hovik.


  Return to Index