Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: Beginning ASP.NET 2.0 and Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 and Databases
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 and Databases by John Kauffman, Bradley Millington; ISBN: 9780471781349
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 and Databases 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 October 22nd, 2006, 08:56 PM
Friend of Wrox
 
Join Date: Jul 2006
Location: olathe, ks, USA.
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default FAQ Case Study - Issue with 1914

Please help. I go through creating the DataSet Object in Step 3. I test the Select and it returns data:

**********************************************
0 3 5 What Instance of SSE do we normally use? SSE, by default, installs with its own instance. R
1 4 1 Why do we sometimes use drivers and sometimes to p OLEDB uses providers; ODBC used drivers. Although
2 5 2 What is the default value for AutoGenerateColumns The defaults for AutoGenerateColumns are a little
3 6 4 What is the write functionality difference between Like GridView, DetailsView supports editing and de
4 7 5 What does the EmptyDataRow property describe? The terminology here is confusing. EmptyDataRow im
*******************************************

HOWEVER, when I try to proceed with step 4, I drop the Gridview on and point it's datasource to the GridView2 and I get only 3 columns--ScoreID, FAQID, & Score (Yes, I'm pointing to the new method in ObjectDataView).

Then..when I try to run the page, I get:

Server Error in '/FAQ' Application.
--------------------------------------------------------------------------------

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Source Error:


Line 699: this.Adapter.SelectCommand = this.CommandCollection[1];
Line 700: Scores.ScoresDataTable dataTable = new Scores.ScoresDataTable();
Line 701: this.Adapter.Fill(dataTable);
Line 702: return dataTable;
Line 703: }



WHAT am I doing wrong???

Regards,
Rob

  #2 (permalink)  
Old October 22nd, 2006, 10:51 PM
Friend of Wrox
 
Join Date: Jul 2006
Location: olathe, ks, USA.
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

I'm still not sure why the drag and drop of the Gridview doesn't work, but I avoided creating the DataSet manually and created my own object that fills a dataset and returns it (see below) and it works. I use the same "Select" statement in the book in my own class. Not sure why the manual dataset gets the errors below. Like I said, when I test the Dataset alone in the .xsd file, it returns (as seen below)...I drag the objectdataset and then drag a gridview and point it to it and I get errors.

Go Figure.

Public Class MyDataObject
    Public Function GetAverageScores() As DataSet
        Dim connStr As String = ConfigurationManager.ConnectionStrings("FaqDatabas eConnectionString1").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(connStr)
        Dim query As String = "SELECT Scores.FAQID, AVG(Scores.Score) AS ScoreAvg, LEFT(FAQs.FaqQuestion, 50) AS FaqQuestionShort, LEFT(FAQs.FaqAnswer, 50) AS FaqAnswerShort FROM Scores INNER JOIN FAQs ON Scores.FAQID = FAQs.FaqID GROUP BY Scores.FAQID, FAQs.FaqQuestion, FAQs.FaqAnswer ORDER BY Scores.FAQID"
        Dim adapter As SqlDataAdapter = New SqlDataAdapter(query, conn)
        Dim ds As DataSet = New DataSet
        adapter.Fill(ds)
        Return ds
    End Function
End Class

Regards,
Rob

 


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
Ch13 Case Study 2 alecwood BOOK: Beginning Access 2003 VBA 0 October 18th, 2007 05:40 AM
Chapter 15 Case Study Sample paul2010 SQL Server DTS 1 November 1st, 2005 05:18 PM
Case Study 1 - VBA 2003 adams77 BOOK: Beginning Access 2003 VBA 2 September 28th, 2005 08:37 PM



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


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