Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 25th, 2010, 10:56 PM
Authorized User
 
Join Date: Nov 2007
Location: , , .
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
Reply With Quote
Reply


Thread Tools
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
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 08: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



All times are GMT -4. The time now is 05:39 AM.


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