Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 July 8th, 2007, 12:47 AM
Authorized User
 
Join Date: Jun 2007
Location: hyderabad, AndhraPradesh, India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query on OnlineDiary !

Hi!I'm Ostwald.I'm an electronics engineer.I'm working on my website. I have a knowledge of c# and asp.net. I have read the InstantResults asp.net2.0. It was really a great experience. The coding is done in VB. I'm converting the code to c#. I'm getting the following errors near data reader and parameters. declarations.
The errors are as follows:
1. dr is declared as variable but used as fuction

SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ;
        cmd = null;

        do
        {
            mEventAttendees.Add((long)(dr("ContactId")));
        }while (dr.Read());


2.Error 44 'System.Data.SqlClient.SqlCommand.Parameters' is a 'property' but is used like a 'method'

cmd.Parameters("@NewEventId").Direction = ParameterDirection.ReturnValue;

3.'System.Collections.IList.IsReadOnly' is a 'property' but is used like a 'method'


public DiaryEvent Item
    {
        get { return (DiaryEvent)List.IsReadOnly(Item(index)); }

}


Kindly sort the errors.
regards
Ostwald!

Surya!
__________________
Surya!
 
Old July 9th, 2007, 07:54 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

In C# collections and arrays are indexed with [] and not with ()

So this:

dr("ContactId")

should be

dr["ContactId"]

The same applies to the other errors.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 9th, 2007, 01:37 PM
Authorized User
 
Join Date: Jun 2007
Location: hyderabad, AndhraPradesh, India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Helli Imar,
Thanx for that reply. Its really great to c ur reply. I have done my 96% of the code rite but another small error is occurin . Its as shown below
1.The name 'index' does not exist in the current context
public Contact Item
    {
        get{return (Contact)List.IsReadOnly[Item[index]];}
    }

2.Cannot apply indexing with [] to an expression of type 'ContactCollection'

InsertEventAttendee(mEventAttendees[ContactCounter].ContactId);


These r the two errors botherin me. After completion of this code, I like to share it here and I also have some of my own projects in c# which i feel will be useful. So can i share em?

regards
Ostwald.

Surya!
 
Old July 9th, 2007, 02:25 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hard to tell without seeing the rest of the code, but it looks like you're trying to create an indexer. In C#, that can look like this:
Code:
public Contact this[int index]
{
  get { return _myList[index]; }
  set { _myList[index] = value; }
}
You need to substitute _myList for the name of your list. Not sure where IsReadOnly comes from or why you need it.

The second problem may go away if you successfully implement the default property.

The best way to your share your code is to upload it somewhere and post a link to it in a new thread with Online Diary C# as the subject. Then I'll ask Wrox to make it a sticky post so others can download the code as well.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 10th, 2007, 07:13 AM
Authorized User
 
Join Date: Jun 2007
Location: hyderabad, AndhraPradesh, India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
Thanx again. I completed the coding. But not yet a perfectone. I'm posting my code kindly check it out!

http://www.4shared.com/file/19565892...lineDairy.html

I have designed a simple forum application based on the blog design that u mentioned in the book, I posted it in a diff thread. Check it out.

regards
Ostwald.

Surya!
 
Old July 10th, 2007, 11:11 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi ostwald,

All I see is the .sln file which is not enough to run the project; it's just a container file with references to other projects.

I also saw your other link about the forum. Since this might be quite off-topic for this book, I think you're better off posting in a different category here at p2p.wrox.com to increate the exposure. That increases your chances to get feedback from other readers....

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 11th, 2007, 06:25 AM
Authorized User
 
Join Date: Jun 2007
Location: hyderabad, AndhraPradesh, India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
        Sorry i uploaded the sln file by mistake. Check this one the complete code. But i'm gettin errors like

'ASP.securediary_editcontact_aspx.ProcessRequest(S ystem.Web.HttpContext)': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\onlinedairy\9fdeaec3\4bada2c0\App_Web_g5nmvi on.0.cs 1897

So check it out once. Here is the code
http://www.4shared.com/file/19639066...lineDairy.html

regards
Ostwald!



Surya!
 
Old July 11th, 2007, 01:40 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at the file DiaryMain.aspx in the SecureDiary folder. The code behind names the class DiaryMain yet in the page directive you have Inherits="Default2"

The same applies to many other files in the site. Use Build | Build Solution from the main menu to have the compiler point you at the other problems.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 15th, 2007, 12:20 PM
Authorized User
 
Join Date: Jun 2007
Location: hyderabad, AndhraPradesh, India.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
         Thanx for that. I changed it. I shall post the project back after i finish it perfectly.I'm also using AJAX applications in it.

regards
Ostwald.

Surya!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
Getting error in OnlineDiary application rsexton BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 June 4th, 2007 03:25 AM
Server Error in '/OnlineDiary' Application. aaaboye BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 October 16th, 2006 03:29 PM
Syntax error in query. Incomplete query clause. dispickle ADO.NET 3 April 16th, 2004 01:04 PM
Error on Make-Table Query In Union Query rylemer Access 1 August 20th, 2003 07:42 PM





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