Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
| FAQ | Members List | 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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
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.

        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)
        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)


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

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)
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

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.
Reply With Quote

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
image/db issue chaosengel PHP How-To 1 July 11th, 2007 02:22 PM
Insert Issue revisited cedwards Dreamweaver (all versions) 13 June 21st, 2005 03:02 PM
Insert issue? cedwards Dreamweaver (all versions) 14 June 17th, 2005 01: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 12:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.