943,752 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 858
  • VB.NET RSS
Oct 3rd, 2008
0

Date and oledb

Expand Post »
I need help,i have a problem,i cant seem to insert from my vb interface to my access database...for example the access field is a fate type......how am i supposed to do it?,like if i enter my date like 24/2/08,it ll go in database,i tried my oledb.varchar,oledb.dbdate also does not work....can some1 help me out with this...everytime i use it i get error in insert into statement
Similar Threads
Reputation Points: 6
Solved Threads: 0
Newbie Poster
mugun is offline Offline
10 posts
since Sep 2008
Oct 4th, 2008
0

Re: Date and oledb

What error message do you get?

Does this work in your code:
VB.NET Syntax (Toggle Plain Text)
  1. Dim oConn As OleDbConnection
  2. Dim oCmd As OleDbCommand
  3. Dim strSQL As String
  4. Dim myDate As Date
  5.  
  6. myDate = CDate("4.10.2008") ' Use your locale date format, like "10/4/2008"
  7. strSQL = "INSERT INTO <mytable> (<my date field>) VALUES ('" & myDate & "')"
  8. oConn = New OleDbConnection("<your connectionstring")
  9. oConn.Open()
  10. oCmd = New OleDbCommand(strSQL, oConn)
  11. oCmd.ExecuteNonQuery()
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: List Box help
Next Thread in VB.NET Forum Timeline: help in my linkin....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC