Array List Vs Query

Jan 7, 2012

I have a few running totals and a name associated with these totals and was wondering if an array would be quicker to use instead of storing it in a database.Basically what happens is I need to search a name and if it exists I add the necessary amounts to the totals and if it doesn't exists I add a new record.

View 4 Replies


ADVERTISEMENT

Program That Will Compare Array Of Grocery List Items Glist And Array Of Coupon Item List

May 27, 2012

I have a program that will compare an array of grocery list items glist and an array of coupon item clist.When I compare the two and if there is a match somewhere in the array I want to have a picturebox visible.When there is no match, I want the picture box not to be visible. [code] The code seems to work great until I come to the else statement.When the code finds a match it displays the picture box and the msgbox without error, but as soon as the message box is cleared, even though i've input it as an ELSE statement, the picturebox goes false again.Does anyone have any idea of how I can "hold" the picturebox to stay visible while the match between the arrays exists?

View 18 Replies

Object Array To Byte Array - Marshal.AllocHGlobal Fragmentation Query?

Jun 14, 2011

I didn't think it fair to post a comment on Fredrik Mörk's answer in this 2 year old post, so I thought I'd just ask it as a new question instead..NB: This is not a critiscm of the answer in any way, I'm simply trying to understand this all before delving into memory management / the marshal class.

In that answer, the function GetByteArray allocates memory to each object within the given array, within a loop.Would the GetByteArray function on the aforementioned post have benefited at all from allocating memory for the total size of the provided array:

Dim arrayBufferPtr = Marshal.AllocHGlobal(Marshal.SizeOf(<arrayElement>) * <array>.Count)

I just wonder if allocating the memory, as shown in the answer, causes any kind of fragmentation? Assuming there may be fragmentation, would there be much of an impact to be concerned with? Would allocating the memory in the way I've shown force you to call IntPtr.ToInt## to obtain pointer offsets from the overall allocation pointer, and therefore force you to check the underlying architecture to ensure the correct method is used*1 or is there a better way? (ToInt32/ToInt64 depending on x86/64?)

*1 I read elsewhere that calling the wrong IntPtr.ToInt## will cause overflow exceptions. What I mean by that statement is would I use:

Dim anOffsetPtr As New IntPtr(arrayBufferPtr.ToInt## + (loopIndex * <arrayElementSize>))

I've read through a few articles on the VB.Net Marshal class and memory allocation; listed below, but if you know fo any other good articles I'm all ears![URL]..

View 1 Replies

.net - Returning A List Using Entity Framework, 'System.Collections.Generic.List Cannot Be Converted To '1-dimensional Array

May 3, 2012

i have issue returning a list in a web method. here is the code

<WebMethod()> _
Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)()
Dim context As New PPEntities

[code]....

the error is

Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'

View 1 Replies

C# - Count Occurences In Byte List/array Using Another Byte List/array?

Jun 20, 2011

I am trying to get a count of all the times a byte sequences occurs in another byte sequences. It cannot however re-use a bytes if it already counted them. For example given the string let's assume the byte sequence was k.k it would then find only 3 occurrences rather than 5 because they would be broke down like: [k.k].[k.k].[k.k]. and not like [k.[k].[k].[k].[k].k] where they over lap and essentially just shift 2 to the right.

Ideally the idea is to get an idea how a compression dictionary or run time encoding might look. so the goal would be to get down to just 2 parts, as (k.k.k.) is the biggest and best symbol you can have.

Here is source so far:

[Code]...

View 3 Replies

.Net List To A SOAP Array And Back To A .Net List?

May 20, 2009

I have a class called Car. Car has a bunch of properties i.e. Car.Color. CarService has a method called GetCars(). Within GetCar, I have a loop that appends a List of, you guessed it.. Cars.[code].....

I get: Value of type '1-dimensional array of Namespace.Car' cannot be converted to 'System.Collections.Generic.List(Of Namespace.Car)'. What would be the best way to convert this 1-dimensional array' back into a List of Cars?

View 2 Replies

Create An Array Of List (not Arraylist) From A List?

Dec 15, 2009

I have a variable declared as...

Dim MyList as List(Of String)
I would like to create an array of these lists of string.
Something like....

[code].....

View 14 Replies

.net - Linq Query To List?

Sep 2, 2011

Dim query = From o In myContainer.MyObjects Select o.MyStringProperty Distinct
Dim myProperties As List(Of String) = query.ToList????? 'no way!!!'
"query" type is IEnumerable(Of String)

I tried to use the query directly as a DataSource of a (infragistic) combobox, but it throws me NullReferenceException, so I decided to convert it to a listof strings, to be a more "classical" datasource.

Dim values As List(Of String) = query.AsQueryable().ToList()
does not work either: Value of type 'System.Collections.Generic.List(Of System.Linq.IQueryable(Of String))' cannot be converted to 'System.Collections.Generic.List(Of String)'.

View 3 Replies

Can't Get The Query To Turn Into A List

May 12, 2009

my query is this: I want all of the characters that are of a membership level in a given area that is of admin or above.

This is what I have so far:

Dim L As List(Of Character) = (From C In MasterCharacterList.Characters.Values _
Where Me.Item(C.CharID).DreamLevel.ContainsValue( _
(From L In _Levels Where L.Value.Admin Or L.Value.BotMaster Select L.Value.MemberLevel).ToList.ForEach) Select C)
Me, in this case, is the members collection.

So far, I can't get the query to turn into a list (hence no .tolist at the end.) I know there's something wrong here, but I'm not sure what.

View 6 Replies

List Of Objects Into SQL Query?

Oct 7, 2011

The scenario is this, I have several variables that are set as a list(of objects). The values for these lists are populated during code via a SQL query. I want to be able to take these values and then use them within another SQL query. Each time the program runs the values will be different and there will be more or less within the list.

View 6 Replies

Copy Linq Query To List?

Sep 12, 2011

'Read RESX file and returns a List(Of ResXDataNode)[code]...

Provide two separate copies of the node? Or will the List and Linq query still be referencing the same data?

View 2 Replies

Populating A List Box With Query Results?

Dec 9, 2009

I am working on making a Windows based application within Visual Basic 2008 Express that could potentially be used for a music school as a project. This application is connected and bound to a Microsoft Access database. Within this application I have a form for adding a new appointment reservation. This form has a combo box that the user can select the lesson type (eg. "I want a piano lesson"). Upon being changed, a list box would be populated with the names of all instructors that have that selection as either their primary or secondary talent.So, my database is bound, the query is written (correctly...i hope), and I don't know how to 1) select the table column that I want displayed in the list box and 2) actually display the query results within the list box. Is this making sense? Probably not, bu

Private Sub cmbLessonType_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbLessonType.TextChanged
'populate the lboInstructor box

[code]....

View 5 Replies

Query A Database To Get A List Of Files?

Mar 11, 2011

I have a question about error handling. I have a Try...Catch Error Handling block and with in the Try section I query a database to get a list of files that need to be opened by AutoCAD (using an AutoCAD script file) and a PDF generated of that DWG file. My problem is that sometimes a user has that particular drawing open that it detects to open up and PDF. I use the following code to determine if it is open or not.

[Code]...

Edit by Moderator: use code tags when posting code. Click on this post's quote button to see how.

View 10 Replies

Return A List From A Compiled Query?

May 8, 2009

I was speeding up my app by using compiled queries for queries which were getting hit over and over.I tried to implement it like this:

Function Select(ByVal fk_id As Integer) As List(SomeEntity)
Using db As New DataContext()
db.ObjectTrackingEnabled = False

[code].....

View 1 Replies

Why Can't Return A List From A Compiled Query

Mar 9, 2010

I was speeding up my app by using compiled queries for queries which were getting hit over and over.

I tried to implement it like this:

Function Select(ByVal fk_id As Integer) As List(SomeEntity)
Using db As New DataContext()
db.ObjectTrackingEnabled = False

[Code].....

View 1 Replies

Array Query Inside For Loop?

Feb 25, 2011

I am having trouble using FOR loop with array in query.What I am trying to do is for all the data pulled out of database I convert it to an array list and then string (this works fine). After that I am trying to make a FOR loop query for each of the data pulled out and this is where i am having trouble.

[Code]...

View 5 Replies

ASP Put Query Into Array And Go Through It Without Refreshing Page

Jun 13, 2012

How would I go about running a query in asp and storing it in an array. Then with the array go through each record without having to refresh the page every time.

For example
Sub loaddata()
Dim conn As New IfxConnection(connectionstring)
Dim results() As String
Dim i As Integer = 0
conn.ConnectionString = connectionstring
[Code] .....

The results are stored in results(i). Say I have a button that says next and everytime I want it to go to the next item in the results array. I don't want the page to refresh. How do I do that?

View 2 Replies

Sql - Query Array Or Create A Temp DB

May 9, 2012

Is there any way to query an array of mine in VB.net? I just need something temporary in order to query it for a report but I do not want to make an external database just for something that's going to be temp. I just need to be able to say select * from tempTable etc etc.

View 2 Replies

DB/Reporting :: Filter A Database Query Using A List?

Apr 23, 2008

How to Filter a Database Query Using a List..

View 2 Replies

How To Write An LDAP Query To List All Of The PCs In A Specific OU?

Sep 14, 2010

Im just trying to figure out how to write an LDAP query to list all of the PCs in a specific OU.

View 3 Replies

LINQ Query For Deleting One Column From List(Of)

Jun 28, 2011

I have this code:

[Code]...

View 3 Replies

Query SQL Server Table Results Into A List?

Apr 13, 2012

I am trying to create a CLR SQL Stored procedure that uses a query and adds the results to a list in VB.NET. Through debugging I determined that my add statement for the reader into the List is somehow converting my data types and throwing an error when I attempt to execute the compiled Stored Procedure.The columns I am querying are Integers

Code:
Imports System
Imports System.Data

[code].....

View 3 Replies

VS 2010 Custom Query Against List<string>

Aug 15, 2011

I have a List<string> that contains paths, such as:

[Code]...

Given a given root, such as Root, I would like to "query" this list to return only the first level values, such as:

[Code]...

View 2 Replies

Load Array From A LINQ Query Using Program?

Oct 25, 2010

I am new to LINQ, but have been able to query SQL using LINQ to SQL and then I can data bind the results to a GRID or DROPDOWN LIST with no problem. What I would like to do is load a column into an array. I have seen examples for something like this in C#[code]...

View 12 Replies

Load Two Dimensional Array From LINQ Query?

Dec 14, 2010

I'm using VB.Net and have the following LINQ Query...

Dim ACFTTail5 = (From tailcounts In db.TailCounts _
Where tailcounts.Model = "UH-60A" _
Group tailcounts By _
tailcounts.Tail, tailcounts.Model _

[Code].....

But get the following error...

"Unable to cast object of type 'System.Data.Linq.DataQuery1[VB$AnonymousType_42[System.String,System.String]]' to type 'System.String[,]'."

View 1 Replies

Sql - Speeding Up .net Access Query To Populate An Array?

Nov 23, 2010

Dim Builders As New System.Data.OleDb.OleDbConnectionStringBuilder
Builders("Provider") = "Microsoft.Jet.OLEDB.4.0"
Builders("Data Source") = "C:UsersJohnDocumentsVisual Studio 2008ProjectsSimpleSQLTestSimpleSQLTestdictionary.mdb"

[code]....

So trying to speed up the query. The read of the last item is just to see how long it takes. I do a different method in VB6 and it loads very quickly. Trying to load a dictionary that is over 200,000 rows.

View 1 Replies

VS 2008 Assigning SQL SELECT Query To Array?

Jul 10, 2009

Scenario: Writing a scanning program, thing is I can't have duplicate file names(which I generate). The img file paths r saved in a database.I'm trying to write a function that will return all the records I need using a SQL SELECT. To make this work I need to put all the retrieved records(just the one field from the database) into an array.My Problem: I have no idea how to put the retrieved SQL query into an array and then return it.

Private Function fileNameAcquisition(ByVal path As String, ByVal id As Integer) As String
Dim conn As New SqlConnection
Dim dr As SqlDataReader

[code].....

View 3 Replies

.net - LINQ Query Returns List Of Empty Objects?

May 3, 2012

I have a query that 'selects' object of a type:

Dim l as IList(Of Foo) = (From dataRow As DataRow In table.Select()
Where CStr(dataRow("Column1")) = "A"
Select New Foo(CStr(dataRow("Column1")), _
CStr(dataRow("Column2")))).ToList()

What's happening is that if i set a break-point to the constructor of Foo and step, the constructor is hit and the parameters are loaded with the arguments. However, l has empty Foo objects (the members in every object are Nothing). What could be happening here?

View 1 Replies

.net - List Of Scalar Values From Entity Framework Query?

Dec 22, 2011

I have Customers table in a database. I'd like to create List of CustomerNames using entity framework 4.1. How can I do that in Visual Basic?

Dim customerNames = (From c In _context.Customers
Select New With {c.CustomerName}).ToList()

brings a list of anonymous objects.

View 1 Replies

Assign Result (from LINQ To XML Query) To List(Of String)?

Jul 6, 2011

Is it wrong? Please suggest me correct way.

Public Function ReadXML() As List(Of String)
Dim list As New List(Of String)
Dim xmlDoc As XDocument = XDocument.Load("C:\MappingFile.xml")

[code].....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved