Wrox Programmer Forums
| 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 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
  #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.


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





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