Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) problem with databinding (Read 8826 times)
Feinfinger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Mar 22nd, 2007
problem with databinding
Mar 22nd, 2007 at 12:53pm
Print Post  
Hallo,
i  installed the trial version of the planner on visual studio 2005 c# , and when i call the function "LoadFromDataSource" i get this error :

System.ThrowHelper.ThrowKeyNotFoundException()

As DataSource i use a bindingsource with a usual Dataset and i have configured the probertymap i needed. Can anybody help me?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: problem with databinding
Reply #1 - Mar 22nd, 2007 at 1:42pm
Print Post  
Hi,

Do you use the schema shown in the Access database that comes with Planner.NET, or have you created your own schema?

I think that at this time Planner.NET requires all resource types to be bound to a data source, even if you won't use them. Have you left any properties from the Binding category empty?

Stoyan
  
Back to top
 
IP Logged
 
Feinfinger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Mar 22nd, 2007
Re: problem with databinding
Reply #2 - Mar 25th, 2007 at 4:29pm
Print Post  
hmm there is no way to avoid this? i'm working with a bindingsource and so there is just one table available for the planner.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: problem with databinding
Reply #3 - Mar 26th, 2007 at 6:54am
Print Post  
Unfortunately that's not possible. We will change this in the next release, but until then you can load a single table only by iterating the dataset items and programmatically creating Planner.NET Appointment objects from them.
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #4 - Oct 7th, 2007 at 12:23pm
Print Post  
Hi, I am new to this and just tried to load the items table alone and got an object not set to an instance error, VB.NET.

Is it still the case that I will have to load all other tables even though they are empty?

I have modified my project to include all the entries in the tutorial9 however I see there are two table adapters:

Code
Select All
RecurrenceExceptionTableAdapter1.Fill(PlannerDataSet.RecurrenceException)
	  recurrenceExceptionsTableAdapter1.Fill(PlannerDataSet.RecurrenceExceptions)
 



Now when I set all the datamember settings for the calendar under properties I see RecurrenceExceptionsDataMember but not one for
RecurrenceException?

All the others match up so I presume this missing one is the one giving the continued exception?

Help
« Last Edit: Oct 7th, 2007 at 4:32pm by elpuerco »  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: problem with databinding
Reply #5 - Oct 8th, 2007 at 6:47am
Print Post  
Databinding is being redesigned so that it would allow loading item data from a single table. It will be no longer obligatory to supply all possible data tables.

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #6 - Oct 8th, 2007 at 10:34am
Print Post  
Ok I see that, but how about dealing with it now as I am getting my bosses to buy the full product based on database support!

So for example when I run the databing tutorial modified for vb.net as follows:

Code
Select All
     Calendar1.Schedule.Clear()
	  PlannerDataSet.Clear()

	  ContactTableAdapter1.Fill(PlannerDataSet.Contact)
	  CustomBrushesTableAdapter1.Fill(PlannerDataSet.CustomBrushes)
	  ItemTableAdapter1.Fill(PlannerDataSet.Item)
	  ItemContactsTableAdapter1.Fill(PlannerDataSet.ItemContacts)
	  ItemResourcesTableAdapter1.Fill(PlannerDataSet.ItemResources)
	  LocationTableAdapter1.Fill(PlannerDataSet.Location)
	  RecurrenceTableAdapter1.Fill(PlannerDataSet.Recurrence)
	  RecurrenceExceptionTableAdapter1.Fill(PlannerDataSet.RecurrenceException)
	  RecurrenceExceptionsTableAdapter1.Fill(PlannerDataSet.RecurrenceExceptions)
	  ReminderTableAdapter1.Fill(PlannerDataSet.Reminder)
	  ResourceTableAdapter1.Fill(PlannerDataSet.Resource)
	  StyleTableAdapter1.Fill(PlannerDataSet.Style)
	  TaskTableAdapter1.Fill(PlannerDataSet.Task)


	  Calendar1.LoadFromDataSource()

 



at the line LoadFromDataSource() I get an error oject not set to an instance?

Even though if I put code in to display the row cound for each adapter no errorss occur?

Help!!!  pls
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #7 - Oct 8th, 2007 at 5:36pm
Print Post  
Hi,

I need to know if the code block above as per tutorial is workable or not?

My employer expects me to design the application to use a shared database on a server.

Simply getting a error stating object not set and nothing else is leaving me puzzled as what else am I supposed to set?

I see nothing different in the tutorial?

Thnx

PS also the change to how the tables are required or not required do you have a timescale for this?
  
Back to top
 
IP Logged
 
fabiogiustini
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 26th, 2007
Re: problem with databinding
Reply #8 - Oct 8th, 2007 at 10:00pm
Print Post  
Hi, I've the same problem with databindig. I've typed the following code:

Code
Select All
Private Sub btn_load_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_load.Click

	  Calendar1.Schedule.Clear()
	  PlannerDataSet.Clear()

	  ContactTableAdapter1.Fill(PlannerDataSet.Contact)
	  CustomBrushesTableAdapter1.Fill(PlannerDataSet.CustomBrushes)
	  ItemTableAdapter1.Fill(PlannerDataSet.Item)
	  ItemContactsTableAdapter1.Fill(PlannerDataSet.ItemContacts)
	  ItemResourcesTableAdapter1.Fill(PlannerDataSet.ItemResources)
	  LocationTableAdapter1.Fill(PlannerDataSet.Location)
	  RecurrenceTableAdapter1.Fill(PlannerDataSet.Recurrence)
	  RecurrenceExceptionTableAdapter1.Fill(PlannerDataSet.RecurrenceException)
	  RecurrenceExceptionsTableAdapter1.Fill(PlannerDataSet.RecurrenceExceptions)
	  ReminderTableAdapter1.Fill(PlannerDataSet.Reminder)
	  ResourceTableAdapter1.Fill(PlannerDataSet.Resource)
	  StyleTableAdapter1.Fill(PlannerDataSet.Style)
	  TaskTableAdapter1.Fill(PlannerDataSet.Task)

	  Calendar1.LoadFromDataSource()

    End Sub
 



AND I haven't left any properties from the Binding category empty, but running the application I get an error oject not set to an instance in LoadFromDataSource line.
Could anyone help me ??pls??!!
Thanks
Fabio
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: problem with databinding
Reply #9 - Oct 9th, 2007 at 5:36am
Print Post  
Here is a preliminary build of the new Planner.NET version:

https://mindfusion.org/_planner/_Planner.NET_422pre_trial_20.zip

You no longer have to specify every possible table when loading and saving data from the database. Instead, pass null references in the call to Calendar.SaveToDataSource for the tables you are not interestes in when saving, or omit the calls to the corresponding table adapters' Fill methods when loading.

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #10 - Oct 9th, 2007 at 1:23pm
Print Post  
Hi Meppy,

I dropped the references to the previous dll's and referenced these new ones but still get the same error from the loadfromdatasource call?

Code
Select All
Calendar1.Schedule.Clear()
PlannerDataSet.Clear()

'ContactTableAdapter1.Fill(PlannerDataSet.Contact)
'CustomBrushesTableAdapter1.Fill
(PlannerDataSet.CustomBrushes)
ItemTableAdapter1.Fill(PlannerDataSet.Item)
ItemContactsTableAdapter1.Fill(PlannerDataSet.ItemContacts)
ItemResourcesTableAdapter1.Fill(PlannerDataSet.ItemResources)
'LocationTableAdapter1.Fill(PlannerDataSet.Location)
'RecurrenceTableAdapter1.Fill
PlannerDataSet.Recurrence)
'RecurrenceExceptionTableAdapter1.Fill(PlannerDataSet.RecurrenceException)
'RecurrenceExceptionsTableAdapter1.Fill(PlannerDataSet.RecurrenceExceptions)
'ReminderTableAdapter1.Fill(PlannerDataSet.Reminder)
'ResourceTableAdapter1.Fill(PlannerDataSet.Resource)
'StyleTableAdapter1.Fill(PlannerDataSet.Style)
'TaskTableAdapter1.Fill(PlannerDataSet.Task)

Calendar1.LoadFromDataSource()

 



I have as you state omitted the fill calls to the unwanted tables but still the same error.

Even if I just have the item table fill call it is still the same?????

In fact I have just removed all the non required tableadapters from form design, removed all the datamember entries apart from item and run the app again.

Now at loadfromdatasource I get the error:

'Key cannot be null' parameter name: key

???

This does have me worried as I have convinced my employer to buy this product but as yet am to see it working with a database?

Can anyone please assist???
  
Back to top
 
IP Logged
 
fabiogiustini
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 26th, 2007
Re: problem with databinding
Reply #11 - Oct 9th, 2007 at 2:25pm
Print Post  
HI, i've updated the dll and the referencies, created a new project, and it's ok: I can bound and load just the table I need.
Now I've another problem: in single month view clicking on load button (loadfromdatasource handled), i see the items on calendar. When I set the calendar in resource view grouping by resource and bounding the resource in dataset, clickind on load the calendar is empty. when I click load button the datagrid I've put inside the form, are correctly filled, but still to see nothing incalendar. The code in load buttun click event is:
Code
Select All
Calendar1.Schedule.Clear()
	  PlannerDataSet1.Clear()

	  ItemTableAdapter1.Fill(PlannerDataSet1.Item)
	  ResourceTableAdapter1.Fill(PlannerDataSet1.Resource)
	  ItemResourcesTableAdapter1.Fill(PlannerDataSet1.ItemResources)

	  Calendar1.LoadFromDataSource()
 



Thanks for help.
Fabio
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #12 - Oct 9th, 2007 at 4:57pm
Print Post  
Hey fabiogiustini could you possibly post the code you used to be able to access the database please?

As you will see above I still cannot get it to work?

Sad
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: problem with databinding
Reply #13 - Oct 9th, 2007 at 5:52pm
Print Post  
Right!

I started a new project.

Followed Tutorial 1
Followed Tutorial 9 up to part 4.

I ran the project and it worked, no calls to databases yet so no problem.

I have the dataset, bindingsource and tableadapter on my form.

I have the properties set for the items member only.

Here is the forms load code

Code
Select All
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	  Calendar1.BeginInit()
	  Calendar1.TimetableSettings.Dates.Clear()

	  Dim i As Integer
	  For i = 0 To 5

		Calendar1.TimetableSettings.Dates.Add( _
		    DateTime.Today.Add(New TimeSpan(i, 0, 0, 0)))

	  Next i

	  Calendar1.TimetableSettings.VisibleColumns = 3

	  Calendar1.EndInit()

	  Calendar1.Schedule.Clear()

	  PlannerDataSet.Clear()

	  ItemTableAdapter1.Fill(PlannerDataSet.Item)

	  Calendar1.LoadFromDataSource()

    End Sub
End Class
 



And once again I get the same error!

Please can anyone please help me with this?

System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Calendar"
  StackTrace:
      at MindFusion.DataBinding.DataSourceTracker.xdf653366cdb56b9d(Object x337e217cb3ba0627, Object xaeebf6cdac58d859)
      at MindFusion.DataBinding.DataSourceTracker.x9641f931b2968145(Object x1563b91fcacc4108)
      at MindFusion.DataBinding.DataSourceTracker.ReadSourceItems()
      at MindFusion.DataBinding.DataBinder.LoadSourceData()
      at MindFusion.Scheduling.WinForms.Calendar.LoadFromDataSource()
      at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\pjh8\My Documents\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.vb:line 25
      at System.EventHandler.Invoke(Object sender, EventArgs e)
      at System.Windows.Forms.Form.OnLoad(EventArgs e)
      at System.Windows.Forms.Form.OnCreateControl()
      at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
      at System.Windows.Forms.Control.CreateControl()
      at System.Windows.Forms.Control.WmShowWindow(Message& m)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
      at System.Windows.Forms.ContainerControl.WndProc(Message& m)
      at System.Windows.Forms.Form.WmShowWindow(Message& m)
      at System.Windows.Forms.Form.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
      at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
      at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
      at System.Windows.Forms.Control.set_Visible(Boolean value)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(ApplicationContext context)
      at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
      at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicat
ionModel()
      at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String
[] commandLine)
      at WindowsApplication2.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
      at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()











Code
Select All
 

Code
Select All
 

Code
Select All
 

  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: problem with databinding
Reply #14 - Oct 10th, 2007 at 6:03am
Print Post  
Fabio, after you perform the loading, you have to specify the resources to group by from the list of resources loaded from the database. The following code works fine for me:

Code
Select All
Dim r As Resource
Calendar1.BeginInit()
For Each r in Calendar1.Schedule.Resources
	Calendar1.Resources.Add(r)
Next
Calendar1.EndInit()
 


Place this code right after the call to the Calendar.LoadFromDataSource method.

Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint