View Single Post
  #1 (permalink)  
Old July 3rd, 2009, 06:20 PM
liamfitz liamfitz is offline
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 Adapting Ch. 20 code, to create a 'SELECT' DataSet ?

I'm using the following code to crete a new dataset, which then repopulates a DataGridView, based on an 'Add Query' DataSet ( creted using the wizard ). I'd like to know the underlying code, so I can slightly adapt it in a sub-routine. For example

Private Sub btnWhatever_Click( ..................................... and so on )

create connection to DB
create an SQL command with (?) in appropriate WHERE clause.
pass the parameter(s) to the command.
execute the command.
fill the DataGridView with new DataSet
close connection

End Sub()

Code:

PrivateSub btnABig_Click(ByVal sender AsObject, ByVal e As System.EventArgs)_ & Handles btnABig.Click
 
Try
Me.CustomersTableAdapter.initA(Me.Bm2009Customers.Customers)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
EndTry
EndSub

In Ch. 20 there's only examples for non-query routines. Any help much appreciated.