Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# proweb2 6/8/2007 7:49 AM (edited 6/8/2007 7:55 AM)
Hi I develop a test module that I call Event Calendar. I need to access of the bbdd for extract the events.

I make this:

using System.Xml;

namespace Cuyahoga.Modules.EventCalendarModule
{
    
	public class XmlBuilder {

		public static XmlElement AppendElement(XmlNode node, string name) {
			return AppendElement(node, name, null);
		}
    
		public static XmlElement AppendElement(XmlNode node, string name, object value) {

			XmlDocument parent = node.OwnerDocument;

			//Something went wrong - assume this is a document
			if (parent == null) {
				parent = node as XmlDocument;
			}

			XmlElement newElement = null;

			if (parent != null) {

				newElement = parent.CreateElement(name);
				node.AppendChild(newElement);

				//Append value if it is supplied
				if (value != null) {
					
					string stringValue = value.ToString();

					if (stringValue.Length > 0) {
						newElement.AppendChild(parent.CreateTextNode(stringValue));
					}
				}
			}

			return newElement;
		}

		public static XmlAttribute AppendAttribute(XmlElement node, string name, object value) {

			XmlAttribute newAttribute = node.OwnerDocument.CreateAttribute(name);
			node.SetAttribute(newAttribute.Name, value.ToString());

			return newAttribute;
		}
	}
}

I make the class ( I try to post it but the server return a 500 error of security). I post the head of file
namespace Cuyahoga.Modules.EventCalendar
{
	
	public class EventCalendarEvents
	{

And call of Nhibernate
public class EventCalendarModule : ModuleBase, INHibernateModule {

        public  IList GetEvents()
        {

            string hql = "from EventCalendarEvents order by E.EventDate desc";
            IQuery q = this.NHSession.CreateQuery(hql);
            //q.SetInt32("sectionId", base.Section.Id);

            return q.List();
               
            
           
        }

      
    }



I follow this steps:

1º Create the module and xml and class file.
2º Install the module ( correct without errors).




I need Help.

Thanks.

# martijnb 6/9/2007 4:04 AM
Can you give us an error message and/or stacktrace? Otherwise it's impossible to guess what's going wrong.
# proweb2 6/11/2007 8:32 AM
in expected: end-of-text (possibly an invalid or unmapped class name was used in the query) [from EventCalendarEvents order by E.EventDate desc] 
# El Gringo 6/11/2007 9:35 AM
proweb2
in expected: end-of-text (possibly an invalid or unmapped class name was used in the query) [from EventCalendarEvents order by E.EventDate desc] 

I am not the best hibernater, but I think it should be this way
...
string hql = "from EventCalendarEvents E order by E.EventDate desc";
...
# proweb2 7/5/2007 12:33 PM
Does not the problem.
# proweb2 7/5/2007 5:14 PM
Thanks for all. I result my error. I mark mapping file as Embedded Resource.(&)

Sorry for the chars in Uppercase on the title of post.