troubleshooting Question

VB.NET: problem with DB dates populating - wrong day/month formats

Avatar of andy7789
andy7789 asked on
Visual Basic Classic.NET ProgrammingVisual Basic.NET
12 Comments1 Solution223 ViewsLast Modified:
Hi X-perts,

I need to create a column in the table with incrementing dates (by months). Here is my code.

The problem is that it creates a column with incrementing days, like

01-Jan-95
02-Jan-95
......
12-Jan-95
01-Jan-96
02-Jan-96

etc

How can I fix this?

thanks
            Dim startDate As Date = New Date(1994, 12, 1)
            Dim nextDate As Date

            nextDate = startDate
                For i As Integer = 1 To diffMonths
                    nextDate = nextDate.AddMonths(1)
                    SQL = "INSERT INTO Trend ([dates]) VALUES (#" & nextDate & "#)"
                    conn.Execute(SQL)
                Next
ASKER CERTIFIED SOLUTION
HainKurt
Sr. System Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros