Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-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
 
Old February 9th, 2006, 12:35 PM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapt 8 Try it out (Inserting).. Page 273

I am having some problems with the try it out on page 273 of chapter 8. My code looks the same as it does on page 275 of the how it works.

The record just isn't going into the database. No error or anything. I have refreshed the page and looked in the database and the record doesn't get created. If I try and put in garbage for the date, I get an error.

Here are some snippets of code:

 <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:WroxUnitedConnectionString %>"
InsertCommand="INSERT INTO [Fixtures] ([FixtureDate], [FixtureType], [GoalsFor], [GoalsAgainst], [Opponents], [Notes]) VALUES (@FixtureDate, @FixtureType, @GoalsFor, @GoalsAgainst, @Opponents, @Notes)"

<InsertParameters>
<asp:Parameter Name="FixtureDate" Type="DateTime" />
<asp:Parameter Name="FixtureType" Type="String" />
<asp:Parameter Name="GoalsFor" Type="Int16" />
<asp:Parameter Name="GoalsAgainst" Type="Int16" />
<asp:Parameter Name="Opponents" Type="String" />
<asp:Parameter Name="Notes" Type="String" />
</InsertParameters>

I have monkeyed around with a few settings here and there.. with no luck.
Thanks,
Rob


 
Old February 9th, 2006, 05:54 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Robert:
I was just about to send a post and you beat me to it by a few hours.
Here's the lowdown.
Go back to the page 270 Try It Out, Updating Existing Records. There are two
things there you have to do because you will be building the Inserting part on
the Updating part.

1st thing. If you check Web.config just as it comes from the Begin folder you will see that it contains an error. It references c:\BegASPNET2\Chapters\End\Chapter07\...
You need to change that to: c:\BegASPNET2\Chapters\Begin\Chapter08\...

2nd thing. Check that SqlDataSource1 dataconnection points to WroxUnitedConnectionString
and not WroxUnitedConnectionString1.

VictorVictor




 
Old February 9th, 2006, 06:01 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Robert:
Forgot to mention in previous reply to your post that Line 8 of the Updating
Existing Records, Chapter 8 also specifies that Figure 8-4 is to be used for
a real run. Note that your gridview from the Begin file only contains 3 columns
FixtureID, FixtureDate, and Opponents. You will have to add, manually the
additional fields shown in Figure 8. This is an error prone process. Go to the
Common Tasks panel and add 'em one at a time. Then re-arrange the order to what
the book has. You'll may have to reconfigure the SQL Select statement to return
the additional fields.

VictorVictor


 
Old February 9th, 2006, 06:16 PM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

VictorVictor,
Thanks for the speedy reply. Everything is working now!
I went back and looked in the Chap 7 database file to see if anything got put in there.. but, nothing was ever written. Why do you think there was no error thrown?

Rob


 
Old February 9th, 2006, 06:21 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Robert:
Yes it is a bit wierd. Best I can figure is that the two sqldatasources are
talking to two different datbases, one in the \End\Chapter07 and the other in
your current project. (See web.config entries on that). Neither database cares
about the other. I'm pretty much paralleling you in the book. Just did the inserting with no problems.
VV








Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4: Page 394 - Inserting ScriptManager VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 April 17th, 2008 08:41 PM
Inserting "fileneme.swf" file into a page labelle ASP.NET 2.0 Basics 0 January 19th, 2007 11:24 AM
how inserting more bitmap graphics in a page? hertendreef ASP.NET 2.0 Professional 0 December 5th, 2006 10:22 AM
Page 273 - HibernateCallbackHandler interrom BOOK: Professional Java Development with the Spring Framework 0 September 8th, 2005 07:05 AM





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