I have an entity related 1:M to Opportunity -- From Tab on Opportunity I call the other entity in Insert Mode, Full screen.
On the load if the form is in insert mode I run an Nibernate query to bring back a single item, I then populate a combobox with these values from this item..
Here is my issue .. I need to add a second field to the SQL query I am running so I bring back Item with two values such as ProductName, ProductFamily..
I am trying to seperate out the items so taht the combox displays the Name and I can use the family somewhere else.. I can't seem to get to the second value in the item and I have tried listitem(1)
Here is my code snippet for what I have so far
<p>string qry = String.Format("Select P.Name, P.Family From Opportunity_Product OP Join Product P on(OP.Productid=P.Productid) Where OP.Status <> 'Open' and OP.OpportunityId = '{0}'", txtOppId.Text); NHibernate.IQuery query = (NHibernate.IQuery)session.CreateSQLQuery(qry) .AddScalar("Name", NHibernate.NHibernateUtil.String)
.AddScalar("Family", NHibernate.NHibernateUtil.String); this.cmbProduct.Items.Clear();
System.Collections.IList list = query.List();
string ProductList = ""; foreach(object listitem in list) { if (ProductList == " ") if (ProductList == " ") { ProductList = string.Format("{0}", listitem); this.cmbProduct.Items.Add("No Closed Products"); } else
{ ProductList = string.Format("{0}", listitem);
.cmbProduct.Items.Add(ProductList.ToString()); }
|