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 25th, 2010, 11:56 PM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using book code with Access 2007 .accdb files

I am trying to work through the book using VS2010 and Access 2007 Northwind database file. I have coded the following and keep getting an error that
No value given for one or more required parameters.
The error is thrown when the code reaches the objDataAdapter.Fill(objDataTable) line before entering the for each loop.
Thanks in advance for any help.
***************Code Below*****
Dim strConnectionString AsString = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=C:\Northwind 2007.accdb;"
Dim objConnection AsNewOleDbConnection(strConnectionString)
Dim strSQL AsString = "SELECT FirstName, LastName FROM Employees"
Dim objCommand AsNewOleDbCommand(strSQL, objConnection)
Dim objDataAdapter AsNewOleDbDataAdapter(objCommand)
Dim objDataTable AsNew Data.DataTable("Employees")
Dim objDataRow AsDataRow
Try
'Open the database connection
objConnection.Open()
'Fill the DataTable object
objDataAdapter.Fill(objDataTable)
'Load the list box
ForEach objDataRow In objDataTable.Rows
lstName.Items.Add(objDataRow.Item(
"FirstName") & " " & objDataRow.Item("LastName"))
Next
Catch OleDbExceptionErr AsOleDbException
'Write the exception
Debug.WriteLine(OleDbExceptionErr.Message)
Catch InvalidOperationExceptionErr AsInvalidOperationException
'Write the exception
Debug.WriteLine(InvalidOperationExceptionErr.Message)
EndTry





Similar Threads
Thread Thread Starter Forum Replies Last Post
Playing MP3 Files in Access 2007 jackkent Access 0 June 7th, 2010 11:39 AM
How to specify relative path to Access 2007 in ADO connection string? [Excel 2007] sektor Excel VBA 4 September 3rd, 2009 11:59 PM
Location of Excel 2007 extracted files sektor Excel VBA 0 May 25th, 2009 07:59 AM
Where to find download code files for this book ? cat2123 All Other Wrox Books 1 November 10th, 2004 09:10 AM
Don't you have ACCESS code for this book? Dango24 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 August 19th, 2004 10:21 PM





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