Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
This is the forum to discuss the Wrox book Visual Basic 2008 Programmer's Reference by Rod Stephens; ISBN: 9780470182628
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 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 June 29th, 2009, 03:46 PM
Authorized User
Points: 312, Level: 6
Points: 312, Level: 6 Points: 312, Level: 6 Points: 312, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2006
Location: Orpington, Kent, United Kingdom.
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Question Command Objects ( S.Q.L. in sub-routine ) ?

I'm trying to 'refresh' an existing dataset and DataGridView, using the following code, in a click-event routine. I'm sure I've got some of the objects/methods wrong. Can anyone assist ? ( Pages 424-427 ?)
Code:
 
PrivateSub btnSBig_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnSBig.Click
' open the connection.
Dim conn_initialcust AsNew OleDb.OleDbConnection(CONNECT_STRING)
conn_initialcust.Open()
' make a command to select the data
Dim cmd AsNew OleDb.OleDbCommand("SELECT Forename, [Middle Initial], Surname FROM Customers WHERE Surname LIKE 'S*';", conn_initialcust)
' execute the command.
Try
cmd.ExecuteReader()
Catch ex As Exception
MessageBox.Show(ex.Message)
EndTry
conn_initialcust.Close()
conn_initialcust.Dispose()
EndSub

I'm sure the problem's from the ' Dim cmd ' line onwards. Thanks.
 


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
Routine Maintenance englere BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 May 2nd, 2009 04:25 AM
Change An Objects Properties Via Sub Routine Rood67 Access 6 October 12th, 2007 12:14 PM
sub Routine problem NitinJoshi General .NET 1 January 5th, 2005 04:10 AM
using command objects. aadz5 ASP.NET 1.0 and 1.1 Basics 5 November 20th, 2003 12:39 PM



All times are GMT -4. The time now is 11:22 AM.


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