Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2006, 03:46 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing an Input Field to a Parameter Query

Beginning Visual Basic 2005 Databases.
Try It Out on page 102
I keep getting error on the following line:

objCommand.Parameters.Add("@ProjectID", OleDbType.Guid, 16).Value = _
            New Guid(txtProjectID.Text)

The error is:
FormatException was unhandled
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

I thought I had mistyped the code, but I get the same error with the downloaded code.

Note: I am using Visual Basic 2005 Express Edition.

Thanks for any help.


 
Old November 6th, 2006, 06:58 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Is the ProjectID field in your Access database defined as a Number and set to a Field Size of Replication ID? If this is the case then you'll need to look up in the online help for Visual Studio the constructor for the GUID structure. I do not have the Express edition installed nor do I have access to a test machine that I can install it on.

Thearon
 
Old November 6th, 2006, 05:13 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, the ProjectID is defined as Number with filed size set to Replication ID.

I've been thru the VB online help already, but at this point in learning, nothing jumps out at me as to how to correct this error.


 
Old November 6th, 2006, 05:58 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured out what I was doing wrong. Not sure what I was thinking but I was clicking on the Parameter Query button before entering the GUID (duh ...). And since the exception for an invalid GUID (blank) was unhandled I got the error shown above.


 
Old November 6th, 2006, 06:06 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I'm glad the problem is resolved.

Thearon





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing xml document as input parameter to web ser neerom XSLT 7 November 14th, 2008 12:58 PM
Passing Input Date Parameter values preethig Crystal Reports 0 February 28th, 2008 08:39 AM
passing parameter to query vladimir Access 6 August 30th, 2006 05:39 AM
passing input to a query mirage Access 3 October 23rd, 2003 08:43 AM





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