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
| FAQ | Members List | 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 July 3rd, 2009, 06:20 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 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()


PrivateSub btnABig_Click(ByVal sender AsObject, ByVal e As System.EventArgs)_ & Handles btnABig.Click
Catch ex As System.Exception

In Ch. 20 there's only examples for non-query routines. Any help much appreciated.
  #2 (permalink)  
Old July 7th, 2009, 10:56 AM
Registered User
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Hi ,

If you are using Wizard to create a DataSet and Tables Adapter use the following code to fill the corresponding tables.
DataSet1 ds1 = new DataSet1();
AnyTableAdapter ata = new AnyTableAdapter();
In any other case if u try to fill programmatic ally use the following methods fill by procedure and fill by Query.

Return DataTable fill by Query method
 public DataTable RunSelectQuery(string sqlQuery, OracleParameter[] @params)
            OracleDataAdapter objDataAdapter = default(OracleDataAdapter); ;
            DataTable dt = new DataTable();
                OracleCommand cmd = new OracleCommand(sqlQuery, dbConnection);
                cmd.CommandType = CommandType.Text;
                objDataAdapter = new OracleDataAdapter(cmd);               
                ResolveParameters(ref cmd, @params);
            catch (Exception oErr)
                throw oErr;
                if ((objDataAdapter != null)) objDataAdapter.Dispose();
            return dt;
Return DataSet fill By procedure
 public DataSet FillDataSetWithProcedure(string spName, OracleParameter[] @params)
            DataSet returnDs = new DataSet();
            OracleDataAdapter da = new OracleDataAdapter();
            OracleCommand cmd = new OracleCommand();
                cmd = new OracleCommand(spName, dbConnection);
                cmd.CommandType = CommandType.StoredProcedure;             
                ResolveProcParameters(ref cmd, @params);
                da = new OracleDataAdapter(cmd);
            catch (Exception ex)
                throw ex;
                if ((da != null)) da.Dispose();
                if ((cmd != null)) cmd.Dispose();

            return returnDs;
The return data Source assigned to specified DataGridView to fill the record.

The above code return in C# supported by Oracle Data Access . if you need any further help let me know about it.

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
Try it out:Ch 16 Dataset Example flhartley VB.NET 2002/2003 Basics 1 August 28th, 2009 07:00 AM
SQL Express & Ch 20 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 1 August 2nd, 2007 05:16 PM
TCPSend/ Receive system.dll problem (ch 20) dingke BOOK: Professional C#, 2nd and 3rd Editions 0 March 10th, 2004 05:42 PM

All times are GMT -4. The time now is 08:47 PM.

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