I have a problem with the retrieval of multiple checkbox values in my program. So as you can see below, I'm trying to retrieve from my database based on a set of values from the checkboxlist.  If I select ONE check box value, the database would be able to retrieve the item, however if I select MORE THAN ONE checkbox value, nothing will appear. Can someone help me please? I've spent quite some time on it.  I've seen other solutions but it doesn't seem to have helped me. Thank you.  protected void chkBoxCategories_SelectedIndexChanged(object sender, EventArgs e) {     // Create the list to store.     List&lt;String&gt; YrStrList = new List&lt;string&gt;();      // Loop through each item.     foreach (ListItem item in chkBoxCategories.Items)     {         if (item.Selected)         {             // If the item is selected, add the value to the list.             YrStrList.Add(item.Value);         }         else         {             // Item is not selected, do something else.         }     }      // Join the string together using the ; delimiter.     Session["UPCategories"] = String.Join(", ", YrStrList.ToArray()); }   The following code is on the other page:   SqlDataSource1.SelectCommand = "SELECT sf.*, sfc.* FROM SkillsFuture sf INNER JOIN SkillsFutureCategory sfc ON sfc.SFCatID = sf.fkSFCatID WHERE sfc.SFCatName IN (@catnames) AND sf.SFPrice BETWEEN @min AND @max AND sf.SFCertStatus='Verified'";  SqlDataSource1.SelectParameters.Add("catnames", Session["UPCategories"].ToString()); SqlDataSource1.SelectParameters.Add("min", Convert.ToDecimal(Session["UPBudgetMin"]).ToString()); SqlDataSource1.SelectParameters.Add("max", Convert.ToDecimal(Session["UPBudgetMax"]).ToString());  SqlDataSource1.DataBind();
3396
How do I parameterize a query containing an IN clause with a variable number of arguments, like this one?  SELECT * FROM Tags  WHERE Name IN ('ruby','rails','scruffy','rubyonrails') ORDER BY Count DESC   In this query, the number of arguments could be anywhere from 1 to 5.  I would prefer not to use a dedicated stored procedure for this (or XML), but if there is some elegant way specific to , I am open to that.
57540
I'm trying to update an account list and I need to get the Ids when the update fails.  I use the getId() method but for accounts which fail I get null.  It's an update so my account already has an Id.  Is it normal ? If it is, how can I get the Ids list of non-updated accounts ?  Here is my code :  List&lt;Account&gt; accountsList = [select Id from Account];  for(Account a : accountsList) {     a.Name = 'Test', }  List&lt;Database.SaveResult&gt; res = Database.update(accountsList, false);  for (Database.SaveResult s : res) {     if (!s.isSuccess()) {         system.debug(s.getId()); // I get null here      }  }
12369
I currently use the   to retrieve data from several SharePoint lists.  This is my current preferred method of coding my way from ASP.NET and WinForms to retrieve this data.   My only issue with this project:  I have to manually generate the SPML file and add this to the development environment, compile it in the project, and only then I am able to use it to connect to the List.  This is great for projects that require connecting to the one and the same list always.  But I am having users creating new workspaces (sites) with each its own List from which I want to retrieve data automagically (same as linq to sharepoint does, but not statically).  Can you recommend your preferred way of accessing data from several SharePoint Lists and sites in C# WinForms and/or ASP.NET outside an actual SharePoint environment where I can specify the a new source site and list at run time?
120029
I need to get some data based on a key field from multiple lists. For this, I may need to do multiple API calls. Is there any way to avoid this ? To get all the data from multiple lists in a single API call ?
77935
How do you split a string?  Lets say i have a string "dog, cat, mouse,bird"  My actual goal is to insert each of those animals into a listBox, so they would become items in a list box.  but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know a better way to do this?  im using asp c#
52590
When I have a Set of Id's and I want to do a dynamic SOQL query that I want to use it in for an IN comparison, I have to convert the Set to string in the format of:  ('id1','id2',id3',...)   The way I do it works, but is not particularly elegant, so I'm wondering if anyone has come up with a better way. Am I missing something? Is there something out there that can just turn a set or list into the properly formatted string?   Here's my code (yes, my example isn't dynamic SOQL, but I've used this several times in dynamic SOQL):   Map&lt;Id,Account&gt; accts = new Map&lt;Id,Account&gt;([select Id from Account]);  String idString = '(\''; for (Id thisId : accts.keyset()) {     idString += thisId + '\',\''; } idString = idString.substring(0,idString.length()-2); //&lt;--this is the bit I hate doing idString += ')';  String q = 'select id from Contact where AccountId in ' + idString;  List&lt;Contact&gt; cts = Database.query(q);
89335
I'm diving into visualforce and the standard controller for the first time and having trouble iterating over a single opportunity's related records. The below code produces an error:  &lt;apex:page standardController="Opportunity"&gt; &lt;apex:pageBlock title="{!Opportunity.name}"&gt;     &lt;apex:pageBlockSection title="{!Opportunity.Id}"&gt;         &lt;apex:repeat value="{!Opportunity.Custom_object__c}" var="c"&gt;             &lt;apex:pageBlockSectionItem&gt;                 {!c.Name}             &lt;/apex:pageBlockSectionItem&gt;         &lt;/apex:repeat&gt;     &lt;/apex:pageBlockSection&gt; &lt;/apex:pageBlock&gt;&lt;/apex:page&gt;   The error I'm receiving is as follows:  Error: Unknown property 'String.Name'   I take from this that the Visualforce is not interpreting the {!c.Name} as the array of objects I thought it was but instead as a string. I am able to save the file when I remove {!c.Name} which makes me think that  is correct but, on the other hand, when substituting value="{!Opportunity.Account}" the code correctly retrieves the related Account. My instinct is that I'm not referencing the related child-objects correctly. I've been banging my head for a bit of time and was wondering if someone could provide some insight as to what is going on?
52808
I have a form with some checkboxes and inputboxes selectboxes and it shows what the user wants via an ajax call. The problem is that when the user click on the item and the detail page is shown and then decide to go back to the previous page he needs to click and select his previous choice again.  I would like to make WP to store all the options in the session when the button to the detail page is clicked and save actual info in the session and then when he visits the page again the  values will be chcecked in sessions and set if any are found.  Could that be done in WP?  If yes, how?  Let's oversimplify that and say that we have something like this in our form:  &lt;input class="car_color" type="checkbox" name="car_color" value="1" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="2" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="8" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="4" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="6" /&gt;   I don't use submit button in my form, it's handled via AJAX on input change.  And in my results get via ajax I have a link to the detail page:  &lt;a class="detail-info-link" href="&lt;?php echo $url ?&gt;"&gt;   Any idea how can I store my values in Session and call them when revisiting/reloading/back button in the browser?  I need to be able to read the session stored stuff and use it via ?Javascript? and trigger my search fuction via ajax which is already working well.  I just need to store (probably before going to $link in href of by detail button and read and send session variables (if they exist).
91517
public static void handleCaseComment(CaseComment caseComment) {    User[] users = [SELECT LastName FROM User WHERE Id = caseComment.CreatedById LIMIT 1]; }   This gives me the following error:  unexpected token: 'caseComment.CreatedById'   How do I use the value of the variable caseComment.CreatedById in a SELECT statement?
46962
Is there some easy way to handle multiple submit buttons from the same form? For example:  &lt;% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %&gt; &lt;input type="submit" value="Send" /&gt; &lt;input type="submit" value="Cancel" /&gt; &lt;% Html.EndForm(); %&gt;   Any idea how to do this in ASP.NET Framework Beta? All examples I've googled for have single buttons in them.
10807
maybe there is a simple answer to my problem:  I have a mssql table ('Person') with a field for first and one for last name. I am coding a Program, where the User should be able to search for persons.     SELECT id, firstname, lastname FROM Person WHERE firstname LIKE   @searchstring + '%' OR lastname LIKE @searchstring + '%'   doesn't work very well, because if the user types 'John W' nothing is found.  For example the person I search for is called John Williams: It should work with searchstrings like 'John W', 'Williams Jo', 'Will' or 'Joh'  Concatenating first and lastname and use %Searchstring% also doesn't work well, because if the searchstring is e.g. 'Will' it should find people who are called Will, Willibald, Williams or Willson or something like that, but not a Person called Goodwill e.g.  And the query should be as fast as possible, because it is executed at every keydown...  edit: forgot to mention that the database must not be changed, because it is from another company.  Thank you for your help.
93545
A colleague of mine and I have had a discussion about filtering with checkboxes on one of our sites.   We use a number of checkboxes to allow the user to refine a search, by selecting their areas of interest when searching. By visiting the search page on our site, the user is given all available results after which a more refined search can be conducted.   The discussion is pertaining whether we should have all checkboxes selected when the user arrives to the page or not. We have seen examples of solutions in the wild, but cannot decide which one to use.   We have two groups of checkbox choices and they will contain approximately five to eight boxes each. One concern is that if all boxes are pre-checked it will be a cumbersome operation for the user to uncheck five or six boxes due to his or her being interested in just one or two of the choices.  Could it be considered a convention to have all results displayed when first arriving to the page with no boxes ticked, and then just checking the ones one want to see in the search result?
113594
I am working with a LINQ to SQL query and have run into an issue where I have 4 optional fields to filter the data result on.  By optional, I mean has the choice to enter a value or not.  Specifically, a few text boxes that could have a value or have an empty string and a few drop down lists that could have had a value selected or maybe not...  For example:      using (TagsModelDataContext db = new TagsModelDataContext())      {         var query = from tags in db.TagsHeaders                     where tags.CST.Equals(this.SelectedCust.CustCode.ToUpper())                      &amp;&amp; Utility.GetDate(DateTime.Parse(this.txtOrderDateFrom.Text)) &lt;= tags.ORDDTE                     &amp;&amp; Utility.GetDate(DateTime.Parse(this.txtOrderDateTo.Text)) &gt;= tags.ORDDTE                     select tags;         this.Results = query.ToADOTable(rec =&gt; new object[] { query });     }   Now I need to add the following fields/filters, but only if they are supplied by the user.   Product Number - Comes from another table that can be joined to TagsHeaders. PO Number - a field within the TagsHeaders table. Order Number - Similar to PO #, just different column. Product Status - If the user selected this from a drop down, need to apply selected value here.   The query I already have is working great, but to complete the function, need to be able to add these 4 other items in the where clause, just don't know how!
12135
I want to iterate through a dropdown, select the first value, then click search, then again select the second value and again perform search.In this code i have tried selecting only one option,but I want to perform search on all the options one by one
40033
Is there a way to pass the array of values to the IN section of a SP as a single paramter for SQL Server 2005?  Ex:  Select * from MyTable where ID IN(@MyValueArray)
40938
After I posted this question, I found a similar post that seemed to answer it: . I'll leave this in place for now, as I am not sure how to mark my own question as a duplicate  In attempting to debug a SOQL query error, I encountered a strange behavior with Database.query and bind variables. Specifically, when I run this code:  String userQuery = 'SELECT Id FROM User'; if (true) {     List&lt;String&gt; firstNames = new List&lt;String&gt;{'James','Joe'};     userQuery += ' WHERE FirstName IN :firstNames'; } Database.query(userQuery);   the Database.query statement executes with no errors, despite the fact that the variable firstNames does not exist in its context. However, when I add an else clause:  String userQuery = 'SELECT Id FROM User'; if (true) {     List&lt;String&gt; firstNames = new List&lt;String&gt;{'James','Joe'};     userQuery += ' WHERE FirstName IN :firstNames'; } else {     List&lt;String&gt; firstNames; } Database.query(userQuery);   I receive a null object reference exception. It seems like Salesforce is checking to see if the variable is only declared once beforehand and, if so, uses its value in the context it was declared. This seems strange to me, so I was wondering if anybody here has any insight into what is going on under the hood.
117047
I've to Query a field(e.g X) from one object. Say I'm getting 20 records(LIST)  Now, I've to Query another object using result of above Query using field X  (X field is common to both objects but has different names, say here Field1 and Field2)  What is the easiest way to get data in Developer console ? is below correct   List&lt;string&gt; TP;  List&lt;ObjA &gt; Ds1=  [Select id, name , TPID__C       from QRS_Quote_LOC_Plan_Bundle__c      where Field3 = '1111']; // Field3 is some another field  For(ObjA  b : Ds1 )  TP.add(b.Field1); // storing common field data  List&lt;ObjB&gt; MasterD = [Select id, name from ObjB where Field2 in :TP ]; System.debug(MasterD );