Enitity mapped on View

Posts   
 
    
kriem
User
Posts: 8
Joined: 21-Jun-2007
# Posted on: 26-Jun-2007 10:16:55   

How do i call the entity that is mapped on a view in the database?

ResultsetFields fields2 = new ResultsetFields(2); fields[0] = VwLocationFields.Location; fields[1] = VwLocationFields.ID; IDataReader reader2 = Adapter.FetchDataReader(fields2, null, CommandBehavior.CloseConnection, 0, true);

System.Data.DataTable comboCollection = new DataTable(); comboCollection.Load(reader2); reader2.Close();

ucboSource.DataSource = comboCollection; ucboSource.DisplayMember = VwLocationFields.Location.Name; ucboSource.ValueMember = VwLocationFields.ID.Name;

This throws an exception. I think the exception was something about an id that's already added. I have changed the code, so i can't throw the exact exception at the moment.

Any help would be appreciated.

jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 26-Jun-2007 15:49:22   

Hello,

when you use a view, you don't know at runtime if it comes from one or many table. So it's difficult to know which entity is mapped on a view. The view allow you to abstract all the table you have behind. Do you want to get the entity after the user selected the name in the combobox? If so, you juste have to make a fetch on the entity using the primary key.

For your exception, could you give us the version of llblgen and the content of the exception if you can throw it again?

Posts: 1
Joined: 28-Jun-2007
# Posted on: 28-Jun-2007 13:56:47   

I am fetching a datetime value executing a view. but i m facing a problem the null datetime field is returning "01/01/0001 12:00:00 AM" but i need "null". even i cant replace it by null. can someone help me? but when i m executing same from a table rather that view. it is working fine!!!!!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-Jun-2007 15:05:31   

I am fetching a datetime value executing a view. but i m facing a problem the null datetime field is returning "01/01/0001 12:00:00 AM" but i need "null". even i cant replace it by null. can someone help me? but when i m executing same from a table rather that view. it is working fine!!!!!

How is this question related to the current thread? I see no relation between them, would you please check the following guidelines: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722

I'll close this thread, please open a new thread for your question.

I am fetching a datetime value executing a view

Also please try to explain your question clearly and provode much details as shown in the guidelines thread.

Thanks.