Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 November 18th, 2006, 02:51 PM
Authorized User
 
Join Date: Feb 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with database

hi folks:

imports system.data

Private schedule As New DataView()

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
  schedule = CType(srcSchedule.Select(DataSourceSelectArguments .Empty), DataView)
        schedule.Sort = "entryDate"
    End Sub
///////////////////////
whenever i run the above code an error message comes up with the following message:

Object reference not set to an instance of an object.
and it highlights the bold message mention in the code.

I wanted this code to highlight the dates in the calendar that have events on them.

Can you please help. thank you very much in advance.

 
Old November 19th, 2006, 06:38 AM
Authorized User
 
Join Date: Feb 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi folks,

I have seen many people read the message and probably my message was not clear.

My program has a calendar. Every time i enter an event date and a description of what's in the event to my table called Schedule, i want to see a highlight of the date in the calendar which is taken from the eventDate in the table Schedule. So every time a preson click on that date in the calendar he should see what the event is about.
Here is the whole code that i have used to make this happened:

Imports system.data

------------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As_ System.EventArgs) Handles Me.Load

        If CalSchedule.SelectedDate = DateTime.MinValue Then
            CalSchedule.SelectedDate = CalSchedule.TodaysDate
        End If

    End Sub
----------------------------------------------------
    Private schedule As New DataView()
----------------------------------------------------

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As_ System.EventArgs) Handles Me.PreRender

        schedule = CType(srcSchedule.Select_(DataSourceSelectArgument s.Empty), DataView) schedule.Sort = "entryDate"
    End Sub
----------------------------------------------------
    Protected Sub CalSchedule_DayRender(ByVal sender As Object,_ ByVal e As DayRenderEventArgs) Handles CalSchedule.DayRender_

        If schedule.FindRows(e.Day.Date).Length > 0 Then
            e.Cell.BackColor = System.Drawing.Color.Yellow
        End If
    End Sub


the problem in the above code is in bold. whenever i run the program an error message comes up and says:"Object reference not set to an instance of an object."

Can anyone knows what's the problem?

I hope this is very clear now and thank you very much for your help.

 
Old November 19th, 2006, 06:40 AM
Authorized User
 
Join Date: Feb 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry the Dashes that i used in some lines is just to show the line of the code is continued in one line.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Searchbar and Database problems gh64 Access 2 January 12th, 2007 11:04 AM
problems connecting to a database allee_man VB Databases Basics 0 December 22nd, 2004 01:05 PM
Database Entry Problems gmoney060 Classic ASP Databases 4 November 9th, 2004 08:19 AM
Please help - Database problems! highcliffevillage Classic ASP Basics 2 July 7th, 2004 08:43 AM
Problems with database Qing JSP Basics 0 July 7th, 2003 09:54 AM





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