Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Save Date In MS Access Database


Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2007, 05:01 PM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,789
Question Save Date In MS Access Database


Hi There,

I'm trying to save a date lets say 06/01/2007 in an Access database but it does save the data but it puts the Month and the Days the wong way around

e.g 01/06/2007, I just cannot figure out why.

My String code is below:
Code:
     SQL = "UPDATE TBLPlan SET" & _
     " [CarillionPlanNo] = " & "'" & Me.ListView1.Items.Item(A).SubItems(2).Text & "'," & _
     " [ContractYearID] = " & Me.ListView1.Items.Item(A).SubItems(3).Text & "," & _
     " [WorkbankID] = " & Me.ListView1.Items.Item(A).SubItems(5).Text & "," & _
     " [WeekID] = " & Me.ListView1.Items.Item(A).SubItems(7).Text & "," & _
     " [CommenceDate] = " & "#" & Me.ListView1.Items.Item(A).SubItems(10).Text & "#," & _
     " [ProjectManagerID] = " & Me.ListView1.Items.Item(A).SubItems(11).Text & "," & _
     " [ShiftTypeID] = " & Me.ListView1.Items.Item(A).SubItems(13).Text & "," & _
     " [StartDate] = " & "#" & Me.ListView1.Items.Item(A).SubItems(15).Text & "#," & _
     " [StartTime] = " & "#" & Me.ListView1.Items.Item(A).SubItems(16).Text & "#," & _
     " [EndDate] = " & "#" & Me.ListView1.Items.Item(A).SubItems(17).Text & "#," & _
     " [EndTime] = " & "#" & Me.ListView1.Items.Item(A).SubItems(18).Text & "#," & _
     " [StartMiles] = " & Me.ListView1.Items.Item(A).SubItems(19).Text & "," & _
     " [StartYards] = " & Me.ListView1.Items.Item(A).SubItems(20).Text & "," & _
     " [EndMiles] = " & Me.ListView1.Items.Item(A).SubItems(21).Text & "," & _
     " [EndYards] = " & Me.ListView1.Items.Item(A).SubItems(22).Text & "," & _
     " [LinesBlockedID] = " & Me.ListView1.Items.Item(A).SubItems(23).Text & "," & _
     " [WorkContentID] = " & Me.ListView1.Items.Item(A).SubItems(25).Text & "," & _
     " [PossessionLimits] = " & "'" & Me.ListView1.Items.Item(A).SubItems(27).Text & "'"

     If Not Me.ListView1.Items.Item(A).SubItems(28).Text = "" Then
       SQL &= ", [Comments] = " & "'" & Me.ListView1.Items.Item(A).SubItems(28).Text & "',"
     End If

     SQL &= " WHERE PlanID = " & Me.ListView1.Items.Item(A).SubItems(1).Text

     DataBase.UpdateRecord(SQL)
I know not very elegant, and I should probably look at paramerters instead but one step at a time, can anybody help me with this.

the field in the database is a Date/Time field.

the pig..
Reply With Quote
  #2  
Old 03-27-2007, 05:24 AM
Zephiroth's Avatar
Zephiroth Zephiroth is offline
Freshman
 
Join Date: Oct 2006
Location: Providence, RI
Posts: 42
Default

Hello Piggy, try setting the field's format to mm/dd/yy. Quick dirty fix, see if that works.
__________________
If Tries.Fail > 3 then Msgbox "Quit!!, no use being hardheaded about it!!":End
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->