p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 8th, 2007, 12:48 PM
Authorized User
 
Join Date: Dec 2006
Location: Port Jefferson, New York, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to brawny4
Default Insert Issue into Acces DB

I am having a problem with the insert of the following code. I am getting the error:

"Data Type Mismatch in Criteria Expression"

I think the issue is with the Date but I don't know what I need to do to correct it.

Code:
        Dim Project As String = Guid.NewGuid.ToString.ToUpper()
        Dim Program_Name As String = "BRX999B"
        Dim Turnover_date As Date = Now()
        Dim objCommand As OleDbCommand = New OleDbCommand

        'intPosition = objCurrencyManager.Position


        objConnection = New OleDbConnection(strConnectionString)
        objConnection.Open()
        objCommand.Connection = objConnection
        objCommand.CommandText = "Insert into Projects" & _
        "(PDF_Number, Programs, Test_Plan, Turnover_date)" & _
        "Values(@PDF_Number, @Programs, @Test_Plan, @Turnover_date);"

        objCommand.Parameters.AddWithValue("@PDF_Number", Project)
        objCommand.Parameters.AddWithValue("@Programs", Program_Name)
        objCommand.Parameters.AddWithValue("@Test_Plan", "C:\Documents and Settings\e352532\My Documents\DB\Projects.mdb")
        objCommand.Parameters.AddWithValue("@Turnover_date ", Turnover_date)


mfb

mfb
__________________
mfb
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old February 11th, 2007, 04:10 PM
Authorized User
 
Join Date: Aug 2006
Location: Charlotte, NC, USA.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubisascends
Default

Now() will return a full date string like 2/11/07 3:45 PM, make sure that your date/time field can handle this.



Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
Albert Einstein
US (German-born) physicist (1879 - 1955)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old February 21st, 2007, 08:43 PM
Authorized User
 
Join Date: May 2006
Location: fayetteville, Arkansas, USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to notrosh
Default

do you have your date field set to a timestamp. you are trying to insert a variable that cannot be inserted into that field. basically you might be trying to insert a string into an integer field.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
image/db issue chaosengel PHP How-To 1 July 11th, 2007 03:22 PM
Insert Issue revisited cedwards Dreamweaver (all versions) 13 June 21st, 2005 04:02 PM
Insert issue? cedwards Dreamweaver (all versions) 14 June 17th, 2005 02:20 AM
Acces Db conversion angel_xpmx SQL Language 1 December 1st, 2004 12:08 PM
DB issue Hasee VS.NET 2002/2003 0 February 11th, 2004 07:57 AM



All times are GMT -4. The time now is 09:40 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc