Wrox Programmer Forums
|
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 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
 
Old September 25th, 2003, 05:31 AM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15: Generating DataSet

Hi I've got a problem when following the book "Beginning Visual Basic .NET"

In chapter 15, which I was looking for, the auther goes through how to work with databases and goes through how to create one in access (I already knew how so...) afterwards he writes on how to connect this one to a new empty windows application but somehow I can't seem to get it to work.

I'll outline what I've done below so you maybe can tell me whats wrong

* Created a new windows application
* Added a OleDbDataAdapter and in the wizard that followed did the following:
  - New connection, Provider, Microsoft JET 4.0 OLE DB Provider
  - Looked up my database
  - Pressed ok
  - Could only select Use SQL statements so picked that one
  - In the Advanced Options unchecked everything (only the first two were checked)
  - Generated a simple SQL statement using the Query Builder
  - Pressed next (No errors: Generated SELECT statement, Generated table mappings)

* Entered menu Data and selected Generate DataSet...
* Accepted everything as it was (New: DataSet1, checked for my created table using OleDbAdapter, checked the bottom checkbox)
* Pressed Ok (ERROR: "There were prolems generating Binding_Data.DataSet1. To resolve this problem, build the project, fix any errors, and then generate the dataset again.")
* Tried to build the project, no problems
* Generated the dataset again but same thing happened

Is there anybody who might be able to help me out here? I really want to be able to start using SQL databases but until I figure out whats wrong I can't
 
Old September 25th, 2003, 08:55 AM
Authorized User
 
Join Date: Jun 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default

Hi

assuming you can connect to the database, you can preview the dataset and so on, the only thing I can think of at the top of my head is a situation I had a year ago. I am not sure if it still applies.

Sometimes, if your field names (the ones returned from the query) are keywords or duplicate field names as in the case where you do a join.
As an example if your field name was Me, it would clash with the VB.NET keyword. If you get a keyword that the compiler thinks is ok (type wise or implicit conversion yields a value deemed ok by the compiler), it may compile but will not work correctly. Now most of the time you will not be able to generate a dataset if the sql is like this, however I have seen cases.

Please check this, and let me know.
behind the generated xsd file there is a .vb file containing the code for your dataset.

if you don't see this file, make sure that you can see all files in the solution explorer by clicking on the Show all files button in the Solution explorer.

Inside this vb code file you will see the DataSet implementation.

Let me know if this helps or not.

Jonathan


Jonathan Crossland
http://www.jonathancrossland.com
 
Old September 25th, 2003, 12:26 PM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure what you mean that I should do. The vbx and the vb file looks ok to me but then again I've never played around with databases in visual basic before either. You asked (indirect) if I could connect to the database and when I press the button labled test connection it works fine.

The table I'm using is made up as following:
Name: Customer
Fields: Customer ID(key), Customer Credit ID, Customer Name, Contact First Name, Contact Last Name, Contact Title, Contact Postion......
There are lots of other fields too. This is the xtreme.mdb that are included as an example in the .NET bundle.

The SQL statement I want to generate same as the book does is:
SELECT
    [Customer Name],
    [Contact First Name],
    [Contact Last Name],
    [Contact Position],
    [Customer ID]
FROM
    Customer ORDER BY [Customer Name]

I don't understand what is wrong. If this is a hard example to understand I would be very happy if you or somebody else could create a small example (database, base code and connection) Either write to me at [email protected] or type in the operations I should include here. One example should solve this mess.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating a Crystal Report using a dataset. Condor76 Crystal Reports 2 February 19th, 2007 06:45 PM
Chapter 15 rrlevron BOOK: Beginning ASP 3.0 0 November 17th, 2005 03:38 PM
Chapter 16 Generating Graphics (PHP5) CCIX PHP How-To 1 July 8th, 2005 07:23 AM
Chapter 16 Generating Graphics (PHP5) CCIX BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 29th, 2005 10:24 PM
chapter 15 manal_sag BOOK: Beginning ASP 3.0 0 April 22nd, 2005 02:23 PM





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