 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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
|
|
|
|
|

December 21st, 2010, 04:15 PM
|
|
Registered User
|
|
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Need table data
I purchased your book because our department is looking to upgrade to ASP.NET from classic ASP, but we are very restricted as to what software we can request on our machines. I have the development environment (Visual Web Developer 2010 Express), but I am not allowed to get an instance of SQL Server for our local machines. But we have a SQL Server 2005 server, which has a 'sandbox' area for testing purposes.
I am only in chapter 12 and am just wondering, if I am just going to make up data for the tables, what is the structure? As far as I can tell there are 2 tables which look something like this:
Genre - ID (int pk), Name (nvarchar(50), SortOrder (int or smallint))
Review - ID (int pk), Title (nvarchar(200)), Genre (int)
Seems simple enough, but what I would really like to know is are there any stored procedures, functions, views, or any other data/settings that I am missing out on by not loading data from the original db file?
It seems to me that these concepts are outside the scope of this book, so I wouldn't expect to see much more than a table with some data in it, but I thought I should still ask.
Thanks.
********EDIT********
Nevermind, I read ahead a little bit and saw that you clearly identified the table structure. Thanks anyway.
Last edited by Falcon397; December 21st, 2010 at 05:05 PM..
Reason: Data types included.
|
|

December 21st, 2010, 05:04 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Quote:
Seems simple enough, but what I would really like to know is are there any stored procedures, functions, views, or any other data/settings that I am missing out on by not loading data from the original db file?
|
Nope; just a handful of tables (you'll add more tables later). As the book describes, you don't need the data from the download, but you can create your own. Check out the last chapter and appendix B for more details on working with remote database.
Another thing to consider is Virtual PC. Not sure if that would be allowed or create other (security) issues, but it would allow you to create another sandbox environment with all the tools you need.
Either way, you should be fine without the databases that come with the book's downloadable code.
Cheers,
Imar
|
|

December 22nd, 2010, 04:59 PM
|
|
Registered User
|
|
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think this is related
So I kind of stumbled on this question by mistake and it is related to data entry and so I was hoping I could continue to post on this thread. I made a mistake in Chapter 13 on the final 'Try It Out'.
In the code behind I told my ItemInserting function to 'e.Values("UpdatedDateTime") = DateTime.Now'. The error here was I typed "Updated" rather than "Update" (which was a pain to track down  ) which caused the record to not save to the DB. I fixed the error and everything worked fine.
But I started to think about it and I remember telling my table to auto insert a value in the case that there isn't a value given to it (Data Value or Binding = getDate() ).
I understand your explination (kind of) as to why it may not be necessary to send a datetime stamp to the DB programmatically. But I don't quite understand why the record would not commit because I mistyped the name of a column that generates a default value in the absense of an assigned value.
I thought that perhaps it was because the variable I was identifying didn't exist and caused the operation to fail, but then I would expect the program to throw an error, not continue as if nothing happened. So why would that misspelling not throw an error, but keep the record from commiting?
Last edited by Falcon397; December 22nd, 2010 at 05:11 PM..
|
|

December 23rd, 2010, 04:26 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
But I don't quite understand why the record would not commit because I mistyped the name of a column that generates a default value in the absense of an assigned value.
|
If you mistype the Values name, an unknown column name is sent to the database where it's used to try and update that column. Since the column doesn't exist, you get an error. The real column would have been updated because of its default value, but it never gets to that.
Quote:
|
So why would that misspelling not throw an error, but keep the record from commiting?
|
You do get an exception,. Put a break point on DetailsView1_ItemInserted and then look at e.Exception. You'll see the reason for the SQL error. The reason you don't see the error in the browser is because of the Redirect statement (using EndEditing) which effectively ignores the error. If you comment out EndEditing you get to see the real exception.
Cheers,
Imar
|
|
 |
|