Dumb Question/Dumb Problem

Dumb Question/Dumb Problem

Old forum URL: forums.lhotka.net/forums/t/2006.aspx


NetStream posted on Tuesday, December 19, 2006

I am trying to create an existing sql table using EditableRootList and Editable Child.  Am I using the right objects?  I believe I have used these before without problems but now I get this error when I hover over the EditableRootList variable - Exception of type: '{System.TypeLoadException}' occurred.  If I try to save this object I get the error - System.NotSupported Exception.  I am using CSLA 2.0 and CodeSmith 3.2.  What am I missing here?

david.wendelken replied on Tuesday, December 19, 2006

NetStream:
I am trying to create an existing sql table using EditableRootList and Editable Child.  Am I using the right objects?  I believe I have used these before without problems but now I get this error when I hover over the EditableRootList variable - Exception of type: '{System.TypeLoadException}' occurred.  If I try to save this object I get the error - System.NotSupported Exception.  I am using CSLA 2.0 and CodeSmith 3.2.  What am I missing here?

If the table already exists, why are you trying to create it? 

Don't think it makes a lick of difference which object type you throw at that problem. 

I'm guessing you meant something else, but I wasn't able to guess what. :)

NetStream replied on Tuesday, December 19, 2006

I have a table in SQL Server that I need to be editable and it doesn't make any difference what combination of objects I choose, I get this same error.  My other objects work just fine, but these don't.  Am I using the correct BO's or should I use some other combination?

david.wendelken replied on Tuesday, December 19, 2006

Sounds like it might be a security problem on the database table.

Are you sure the role you are logged in has the necessary insert, update or delete grants?

NetStream replied on Tuesday, December 19, 2006

I was hopeful that you were on to something.  However, both SQL Server 2000 and 2005 give me the same error no matter which transaction type I choose, even none.  I even gave the login system administrator type access and still the same error. 

david.wendelken replied on Tuesday, December 19, 2006

What sql statement are you issuing, and what error message do you get?

NetStream replied on Tuesday, December 19, 2006

I'm selecting the AddMessageList function which executes the GetMessagesAll stored proc.  The issue is I do not get an error until I go to issue the MessageList.Save function.  If I hover over the messagelist variable, I see the message "mMessage Count=Exception of Type: '{System.TypeLoadException}' occurred."  I just created a brand new project with just this set of BO's and get the same message.  If I use the child object by itself to return just one row of data from a table, it works just fine.  But matched up with this list object, I cannot get it to work.  The table is just 3 varchar and 1 date variables and all 4 make up the primary key.  I have tried every set that CodeSmith offers and get the same message with each one.  These are the calls I make:

1.  Private mMessage as DataMessageList

2.  mMessage = DataMessageList.AddDataMessageList()

3.  mMessage.Add(DataMessage.NewDataMessage("2006-00001", New SmartDate(System.DateTime.Now), "FRNLoad", "Successful"))

4.  mMessage.Save()

If I hover over the mMessage before line 2 executes, I get nothing as the value

If I hover over mMessage in line 3 before it executes, I get the above error message.  I can single step through the code and not a single exception fires but I still get the above error message.

Wal972 replied on Wednesday, December 20, 2006

Just thinking, but if my memory serves me correctly but should it go something like this

Private mMessage as DataMessageList = DatatMessageList.AddDataMessageList()

rathere than two lines.

Hope it helps

Ellie

NetStream replied on Thursday, December 21, 2006

I tried many different ways and still the same error.  I even tried different machines and accessing SQL Server both remotely and locally and still the same error.  In fact, I get the same TypeLoad Exception when I build the objects manually using the book, but they will save OK.  That is something for Rocky to address, if possible.  CodeSmith VB templates suck big time.  They absolutely will not execute the Update function.  I tried the 3.2 beta templates and the 4.0 templates for VB and C# and still the same errors.  Only when I build them manually, like I have always done in the past, will they operate successfully.  Does anyone have templates they have modified that work that they would like to share?

jwooley replied on Friday, December 29, 2006

I believe the message you are seeing in the debugger windows is erroneous. If you type "? mMessages.Count" in the immediate window, it should return the correct value. I have replicated this issue with Project Tracker as identified in the following thread: http://forums.lhotka.net/forums/thread/7305.aspx

Jim Wooley

Copyright (c) Marimer LLC