These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problem with connecting to database using NHibernate
PostPosted: Thu Nov 05, 2009 4:22 am 
Newbie

Joined: Thu Nov 05, 2009 4:11 am
Posts: 2
Hello ,

I'm new to NHibernate and I'm having a very upsseting problem : I can't seem to get it to work :(.
I'm using Visual Studio 2008 SP1 and Microsoft SQL SERVER 2008. I have a local data base called : Test and a table Products which looks like this :
Id - type int , primary key , identity
Name - type nvarchar(50)
Price - type int
Description - type nvarchar(50)

My project is a ASP.NET Web Site.

And just want to connect to my database and do a simple select on the Products table so that I can see that it works.
Can anyone please help me. Give me a clear walkthrough of all the steps that a have to take to achive this ?
Which .dll-s I have to include in my project, what line of code do I have to add in my web.config file, how should mai Products.hbm.xml file look ( I've tried working with examples I found on the net .. but it doesnt want to work for me :( )
My Products.cs file looks like this :

using System;
using System.Reflection;
using NHibernate;
using NHibernate.Cfg;

namespace TestNameSpace
{
public class Products
{
private int id;
private int categoryId;
private string name;
private int price;
private string description;

public int Id
{
get { return id; }
set { id = value; }
}

public int CategoryId
{
get { return categoryId; }
set { categoryId = value; }
}

public string Name
{
get { return name; }
set { name = value; }
}

public int Price
{
get { return price; }
set { price = value; }
}

public string Description
{
get { return description; }
set { description = value; }
}
}
}

Please help me, I've wasted a hole day with this and it's getting very frustraiting.
Thanks :)


Top
 Profile  
 
 Post subject: Re: Problem with connecting to database using NHibernate
PostPosted: Sat Nov 07, 2009 4:20 am 
Newbie

Joined: Thu Nov 05, 2009 4:11 am
Posts: 2
Please .. can anyone help ?


Top
 Profile  
 
 Post subject: Re: Problem with connecting to database using NHibernate
PostPosted: Thu Nov 12, 2009 2:41 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have a look here:

http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.