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 September 5th, 2008, 01:28 PM
Registered User
 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# Ch.8 try it now on pg266-267

I'm using VS2005 and SQL Server 2005 running them on XP pro sp2.
I finished the steps and attempted to test it, the gridview worked perfectly, however when I tried to update the details view I got this error.

"The data types text and nvarchar are incompatible in the equal to operator."

I have no idea where this is in the source code to even attempt to fix it. Nor do I even know what it pertains to. When I googled it I was told the problem is likely caused by the automatically generated update query in the datasource control. And it should be modified to look something like this.

"UPDATE[TheTable] SET [Source][email protected] substring([Source],1,4096) = @original_source......"

The red part being what they said to change but I'm not familiar enough with SQL to understand what the substring and the numbers mean.

Any help would be greatly appreciated!!!
 
Old September 5th, 2008, 02:38 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

An ntext type is used to hold a very long string, up to 2 GB of data. Because it can be so large, it can't be treated as the simple string types that varchar or nvarchar are. So, you can't compare the two like this:

myNtext = myVarchar

Apparently, the instructions you got try to work around this issue by getting a (long) substring from the ntext field. This substring can then be compared with another shorter string like nvarchar.

If you don't really care about the concurrency check (whether another user has modified the row you're working with since you last got your version) you might as well remove the @Source column from the WHERE clause.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old September 8th, 2008, 01:33 PM
Registered User
 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help but what if I did what to keep the concurrency check?

Also I don't see the data types text and nvarchar anywhere in the source code so where is that coming from?

 
Old September 8th, 2008, 01:51 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't know where they are coming from. I don't have the book, nor did you link to the article you talked about, so I could only judge on what you've posted here. Isn't Source an ntext data type in the database? Otherwise the whole point is a bit useless.....

Concurrency can also be implemented using a SQL Server timestamp column. The SQL Server Books Online discuss this in more detail. Also, Google will give you a lot of results. It's not as easy to implement as the "all column" check though.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old September 8th, 2008, 02:25 PM
Registered User
 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again Imar, guess I'll just turn off the concurrency check and move on since it worked in the gridview anyway which is how I would do it for my projects. It also looks as though the book isn't keeping the details view intact for future chapters.

 
Old September 8th, 2008, 02:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, seems like a wise decision. I am not a big fan of this model as it passes around a lot of data. For simple tables (like a Category table with just an ID and a Name) it works fine. but with longer columns like NText it can become a bit messy.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old December 11th, 2008, 04:03 PM
Authorized User
 
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default Hello,

Could you please be more specific, hot to turn off the concurrency check?
I have got exactly the same error!
Thank you in advanced!
 
Old December 11th, 2008, 06:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi fh84,

When you configure the SqlDataSource you get an Advanced button. When you click it, you get the option to turn on or off the concurrency checks.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 17th, 2008, 10:16 AM
Authorized User
 
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default Hello,

Well I tried what you told me and now comes up with this error.

System.ArgumentException: The version of SQL Server in use does not support datatype 'date'.

Could you please give me some advice.

Please note that I am a student....therefore be as much specific as you can.
Thank you!
 
Old December 17th, 2008, 12:55 PM
Authorized User
 
Join Date: Dec 2008
Posts: 56
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via MSN to fh84
Default

Please note that when i edit the gridview then works fine. However when either edit or insert a new record through the detailsview then i have that error!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 2 - Ex 2 jkiernander BOOK: Ivor Horton's Beginning Visual C++ 2005 0 December 29th, 2007 08:47 PM
Ch 2 example 2-5 question Bo BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 August 16th, 2006 07:44 AM
Ch 2 Try It Out Example 2-4. Different results. VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 5 March 27th, 2006 12:12 PM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM
ch. 2 with C# Justin BOOK: Beginning ASP.NET 1.0 1 July 10th, 2003 03:59 PM





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