Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCBO not workingCBO not working
Previous
 
Next
New Post
2/3/2013 5:18 PM
 
I'm writing on module for display songs for a good self-training exercise. Can anybody help me out? My CBO query isn't working, but the commented out query is. Can someone point me in the right direction?
Thanks
-Phil
public static List GetSongs(int portalId, string title)
{
//List l = new List();
//IDataReader dr = DataProvider.Instance().GetSongs(portalId, title);
//while (dr.Read())
//{
// Song t = new Song
// {
// Title = dr["Title"].ToString(),
// Artist = dr["Artist"].ToString()
// };
// l.Add(t);
//}
//return l;
return CBO.FillCollection(DataProvider.Instance().GetSongs(portalId, title));
}
 
New Post
2/4/2013 1:22 PM
 
When you use CBO you need pass in what type of Object you are trying to fill. Check out some of the examples on the latest code I checked into the Task Manager project (been working on a new version for DNN7)

http://dnntaskmanager.codeplex.com/So...

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
2/5/2013 8:54 PM
 
public static List GetSongs(int portalId, string title)
{
//List l = new List();
//IDataReader dr = DataProvider.Instance().GetSongs(portalId, title);
//while (dr.Read())
//{
// Song t = new Song
// {
// Title = dr["Title"].ToString(),
// Artist = dr["Artist"].ToString()
// };
// l.Add(t);
//}
//return l;
return CBO.FillCollection(DataProvider.Instance().GetSongs(portalId, title));
}

So I have passed the object. Not sure why I didn't have that in my original posting. I'm still getting back a blank response when using the following in the front-end ascx:
DataBinder.Eval(Container.DataItem,"Artist")

However, the same works when using the commented code. Adding ToString() at the end of the DataBinder gives an error (probably due to object cast):
A critical error has occurred.An unexpected error has occurred

The cs file contains a call to the controller which returns a list of songs:
rptSongs.DataSource = SongController.GetSongs(PortalId, txtSearch.Text);

When using the CBO, it returns the correct number of records, but the fields are empty! Ahh!
 
New Post
2/6/2013 1:32 AM
 

phibud,

try using

return CBO.FillCollection< song >(DataProvider.Instance().GetSongs(portalId, title));

Are you trying to get one song or a list of songs? To get only one, you can use

return CBO.FillObject< song >(DataProvider.Instance().GetSong(songId));

(Don't use spaces between the angle brackets and the object's type, it's just to make it visible here in the forum)

Best wishes
Michael


Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
2/8/2013 9:03 PM
 
Bah. I think the forum cut out my < song >. The point is. I am using < song >. It returns the correct number of items. I am trying to get multiple results. I just don't get it. I'll use the commented out section til I can figure it out. It appears whatever I'm doing at least isn't blatantly obvious (which I guess is good).

Thanks for the input folks.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCBO not workingCBO not working


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out