RSS Forums RSS

Date and oledb

Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
Reply
Posts: 10
Reputation: mugun has a little shameless behaviour in the past 
Solved Threads: 0
mugun mugun is offline Offline
Newbie Poster

Date and oledb

  #1  
Oct 3rd, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Posts: 650
Reputation: Teme64 is on a distinguished road 
Solved Threads: 106
Teme64's Avatar
Teme64 Teme64 is offline Offline
Practically a Master Poster

Re: Date and oledb

  #2  
Oct 4th, 2008
What error message do you get?

Does this work in your code:
  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()
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 565 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:34 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC