I have this online quiz that generates random questions, but the only problem is that it repeats the previous questions. I have limited questions (I have 10 questions in my table, but I have limited the number of questions to be 5. The output would only display 5 random questions) which I named as RequiredRecords.
question_id 1 3 4
[code].....
I have tried to visit this question, but it doesn't resolve my problem. Below is some of my code and SQL statements I used.
I figured out that there's nothing wrong with my query on creating random questions and I can display it with no duplication, but there's something wrong with my other codes that makes the program having a duplication.
Code Behind using VS2008 3.5 Partial Class Student_DetailView Inherits System.Web.UI.Page Shared TotalRecords As Integer
I have a DataTable with about 64 columns, including "UserAnswer", "CorrectAnswer", and "QID_Lookup". I am building a LINQ that will select all the rows that have a correct answer (user answer matches correct answer), but I only want to select rows that have distinct "QID_Lookup".
[Code]...
The problem is that the result set includes duplicate QID_Lookup values. How can I include only distinct QID_Lookup values? keep in mind that there are 64 columns, so if I can avoid it, I wouldn't want to list each column individually for selection.
I have a collection (a Dictionary, actually) of strings as the key and strings as the value. The value strings are filenames. I wish to find which elements contain a certain filename as the value, returning the Key so that I can modify the Value (change the filename).[code]....
I'm converting a library from C# to VB.net which so far hasn't been too difficult. One class though implements IEnumerable and IEnumerator and contains a block of code like this:
public class MyClassCollection { // Assume all other necessary code is in place
Say a collection grow. Once it's size reach 10k, I want to get rid the first 9k. How to do so?Oh ya I could use removeRange.Is there another function that will output say, the last 1k of the element, say if I do not want to remove anything? Something like tail or something.
I have the following XML which I load via XDocument.Load(uri) or XElement.Load(uri). I am having trouble getting a collection of <asset> elements via LINQ.
Here is a snippet of the XML I'm trying to query: <assetCollection xmlns="tag:aisle7.net,2009:/api/1.0"> <title>All Assets</title> <description>Collection containing all assets in the system</description> <resourcePath>/us/assets/~all</resourcePath> [Code] .....
I created a method and pass the element type, id, and any inner text that instantiates a new html element. The last statement: Me.Controls.Add(element) adds it to the end of the page, but I would like it to be inserted in a specific position (between 2 divs within a form). What I am describing is very similar to this post on SO here, although it was for javascript.
Is it good practice to store sub-collections of item X inside a parent collection of item X for caching 'filter-queries' which are performed on the parent collection? (They won't be used together (as in color AND type).) Or is it also ok to just Loop over the collection and return the correct entities in a temporary collection?
I have been researching for a couple of days now and to no avail. Does Anyone know how to make a custom collection that take advantage of the collection editor? I would like to be able to have 3 Color Values, 1 Boolean and 1 String.
I'm trying to support Basic.NET on my framework so I'm trying to convert C# 4 code to Basic.NET 10. Microsoft is committed to "co-evolve" these two but I'm having a problem with collection initialization... I found that I can initialize a collection much like in C#:
I've got the following ADO.NET Entity Framework Entity Data Model:I want to find all the Policyholders with both a Service of a given Id and also a Keyword of a given Status.
This LINQ Does Not Work:
Dim ServicesId As Integer = ... Dim KeywordStatus As Integer = ... Dim FoundPolicyholders = From p As Policyholder In db.PolicyholderSet.Include("Keywords").Include("Services") _ Where p.Services.Id = ServicesId _ And p.Keywords.Status = KeywordStatus _ Select p
The Where clause cannot search the p.Services and p.Keywords EntityCollections in that way.
currently in my application I have a Global Collection that is a Collection of Collections.Currently I am trying to add items/ elements to one of the child collections of the Global Collection but I am unable to use the collections methods of the child.When I assign a variable to the child collection and return the collection it is just an object with the collection inside.
Ex: Dim GlobalCollection as New Collection Dim ChildCollection1 as New Collection Dim tempCurrentCollection[code]......
I've been working with a CMS called InsiteCreations 2008. I'm running into an error I just can't wrap my head around. I would even be willing to compensate anyone a small amount over paypal, for a solution. The error is rare in occurance, and appears when clicking about 3-4% of links to other pages within our CMS.The full code page is quite large, but there seems to be only one function associated with the error. The error also only appears when not logged into the CMS. If logged into the CMS, clicking the link simply displays the page as normal. I have already checked permissions on the page from the CMS admin console, and it is public.
The error message is as follows:
Server Error in '/' Application.Collection index must be in the range 1 to the size of the collection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Public Class Store Public Overridable Property Areas As List(Of Area) End Class Public Class Area
[code]....
What's the quickest way to get a total count of shelves for a store? I.e. for a store I get the total count of areas by using Areas.Count Or will I need to loop through each area and tally the count of shelves?
I have an ASP.NET app with lots of textboxes all over the page that need updating at various points through program execution. These textboxes actually belong to a certain class, so for easy updating I thought I could create a Dictionary(Of string, object) and add the control.ID and the control to it and then for updating do something like this:
I need to convert a VB Collection to a modern one, like Dictionary or Hashtable. For my approach, I need the Collection's KEYS. Googling tells me that it's impossible. Re-writing the entire application using new collections is not an option as the application is really old and large (converted from VB6 to VB.Net).Using the old Collection also is not good - as there are new components in development.Converting a - for example - Hashtable to Collection works:
using VBCollection = Microsoft.VisualBasic.Collection; public static VBCollection ToVBCollection(this Hashtable table) {
In VB6 I would have several different recordsets opened one after another to
A. Find all the unique project names within the table (and put them into a For/Next loop)
B. For each unique project name open a recordset to look up unique vendor names applicable to it (add For/Next)
C. For each unique projname, unique vend combination find unique exptype....for next loop....
D. For each unique projname, vendor name, exptype, date combination, sum up the dollar amounts...
The end effect is that you have a net dollar amount for each unique combination of project/vendor/expensetype/date.I dont like doing it like this because I have to keep hitting the database, I wanted to know if there was something I could do within the actual dataset which will be filled when I open the application with the values of the entire table..I got to ds.tables("Text").select.distinct( ....not sure how to proceed and everthing I've read online leads me into a complicated direction of creating new datatables...
I load a 47,000 line Text file into a Datagridview, not a problem at all.
I would like to get the Distinct values for Column1. I have been scratching my head on how to do this, I have not as of yet found an easy way to do this,
If I would connect to database I would run a query like this: "Select distinct Column1, column2 from tablename where somefield=somevalue order by column2". How can I run this query to a datatable? I know .select but that's not enough like dataset.datatable("name").select(filter,short). Still need distinct.
When the user has typed in some information I would like to output possible matches in a descending order, so if someone types in a full first name and a full surname, it should be listed above a result where just the surname matches.I've done something similar in SQL before which worked perfectly, but this time I'd like to do it in LINQ.
Firstname, Surname, City, Country as string variables. Dim DataEnum As IEnumerable(Of frmTelephone.clsPerson) = alPerson.OfType(Of frmTelephone.clsPerson)()