.Net Linq - Doing Operation On The Subset

Jun 16, 2010

I need to have the following : (name1 + "a") + (name2 + "a") + ...

Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).SomeLinq(...)

I don't know what to add at the end to add an "a" to each element...

View 2 Replies


ADVERTISEMENT

Returning Subset Of Dictionary With A Complex Type As A Key With Linq

Oct 5, 2010

I have a collection as follows

Private _bankRates As Dictionary(Of RateSourceBank.Key, RateSourceBank)

Where RateSourceBank.Key is simply

Public Class Key
Public RateType As String
Public EffectiveDate As DateTime

[Code].....

View 1 Replies

LINQ To SQL Generic Class For Insert And Delete Operation?

Nov 27, 2009

I have been writing same code for insert, update, delete with LINQ over and over again. I want to have some sort of generic function for Insert, Update, Delete operation. I read a post here like the following :

public static void Insert<T>(T entity) where T : class
{
using (OrcasDB database = new OrcasDB())

[code].....

View 2 Replies

.net - VerificationException Operation Could Destabilize The Runtime On Simple LINQ Query

Jun 11, 2009

The code below works fine on my development PC, but when I deployed the app, it crashes.

Here is the lines of code that are relvant

Private TdsTypesList As List(Of TDS_Type)
...
TdsTypesList = (From tt In db.TDS_Types Select tt).ToList

[Code].....

I have many queries that are using linq, and none of them throw any errors. The set of data is not very large either, less that 100 rows. I dont know if I have any other queries that do not have where statements in them that work.

Running .net 3.5 without sp1 on the client machine, although I am running sp1 on my development PC. looking for a solution that doesn't require sp1 to be installed.

Edit Code breaks on the second line when remote debugging.

I looked over [URL] and tried the following, with the same error.

TdsTypesList = tl.OfType(Of TDS_Type)().ToList

I finally found a dirty workaround. Instead of pulling all of columns from that table, I was able to re-write the query to omit 1 column. This returns an object of anonymous type, and I can use that object. I still would like to know what causes this though.

View 1 Replies

Getting Value From Subset Of Arraylist?

Mar 5, 2012

how to achieve what am trying to do below. am trying to have a set of numbers in different list into and array. so i can select any list in the array as random and get the values in the selected list.

Dim list1 as New List(Of Object)
Dim list2 as New List(Of Object)
'adding items to list 1

[Code]....

View 3 Replies

Convert A Delphi Copy Operation To A .Net Substring Operation?

Jan 4, 2012

I'm trying to convert code from Delphi to .Net. I'm stuck on one line:

//Delphi code ss := Copy(ss, Length(ss), 1) + Copy(ss, 1,Length(ss) - 1); 'vb.net code ss = ss.Substring(0, ss.Length - 1) + ss.Substring(1, ss.Length - 1)

Delphi combines the two substrings, while .Net just concatenate them like a copy.

View 2 Replies

LINQ - Using "Build A Program Now" Ebook - Error "The Method Or Operation Is Not Implemented"

Jun 12, 2009

I am new to Visual Basic 2008 and NET and am using the Visual Studio 2008 Express editions. I recently downloaded the ebook "Build a Program Now!" for VB and have been working through it without problem until te end of the penultimate chapter 8.

Part of the exercise includes the following code:

Private Sub tsbFilterByMake_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbFilterByMake.Click
Dim filteredByMake = From Listing In Me.CarTrackerDataSet.Listing _

[CODE].........

Whenever I attempt to execute this code, I get the error "The method or operation is not implemented" on the last line before the End Sub. This suprised me because when I typed in the f after the = sign, Intellisense offered me the single choice of the required filteredByMake, suggesting to me (in my probable naivety) that it recognised it as a syntactically corrrect choice. This is not down to an error on my part somewhere in attempting the exercise as I get the same result trying to run the Complete code solution that accompanies the book. I have successfully replaced this and a similar Sub with SQL queries on the datasets in question, why the above code does not work and what can be done to correct it.

View 8 Replies

C# - SQL To Filter A SubSet Of Data?

Jun 2, 2010

I have an arraylist that holds a subset of names found in my database. I need to write a query to get a count of the people in the arraylist for certain sections i.e. There is a field "City" in my database from the people in the arraylist of names I want to know how many of them live in Chicago, how many live in New York etc.

how I might set up an sql statement to handle this. I think somehow I have to pass the subset of names to sql somehow.

Here is a sample how I am writing my sql in my code

Public Shared Function GetCAData(ByVal employeeName As String) As DataTable
Dim strQuery As String = "SELECT EMPLID, EMPLNME, DISP_TYPE, BEGIN_DTE FROM Corr WHERE (EMPLNME = @name)"

[Code]....

I need a way to create a function using your sql statement to return a datatable object of names and the parameters would be city, and the List of names.

The above example isnt the sql I am looking for its just a skeleton of what the function would look like that I want to create.

So then you would use the function by iterating through all the cities passing in the same set of names each time in the fron end.

View 5 Replies

Output Each Subset Of The List

Feb 16, 2011

I have a list and I need to output each subset of the list for example a b c d e would output to

[Code]...

I believe the correct term is combination no element should be duplicated on the same line I was going to attempt this with a series of loops but im not even sure wehre to start

View 3 Replies

Search Through A Subset Of Properties For A Given Value?

Aug 12, 2010

I am working with the MP3IDV1 class from this link: [URL] I am pulling the ID3 tags from music files, and this class returns the Genre in number form. However, it has the property Genres with that entire list.

Public
Enum
Genres As

[Code].....

View 5 Replies

VS 2010 Get A Subset Of Into Another DataTable?

May 19, 2011

I have a DataTable that I need to get a subset of into another DataTable to bind to a control. Is there an easy way to do this?

View 4 Replies

Bind Gridview To Subset Of Array?

Dec 9, 2010

I have an array of objects I get from a web service. The 1st element in that array is meant to be displayed in a asp.net literal control. The rest of the elements are meant to be bound to a gridview.

View 1 Replies

C# - Get Subset Of Elements After Performing Remove()?

Jun 21, 2009

If I have code like this (C# or VB.Net does not matter)

Dim e As IEnumerable(Of XElement) = _
From s In _dataSourceSettings.Elements _
Where s.Attribute("name").Value = toInsert.Attribute("name").Value
If e.Count > 0 Then
e.Remove()
End If

How do I get now new _dataSourceSettings without element that I removed?

View 1 Replies

Code To Find Subset Of String

Aug 22, 2011

I am working on a function that returns an array of variable-length strings that have a certain starting and ending delimiter. The input to the function is a string. I am able to do this by using if-then statements with InStr(). I was wondering someone knew of a more elegant way. I tried using the split command but I am splitting on one delimiter so I don't really get the result. I could then parse from the results but I am back to the same boat with using InStr().

[Code]...

View 1 Replies

Pass Subset Of An Array To Function?

Jun 25, 2010

I have a simple VB.Net Form that acts as an interface to a control library with a public API.

One of the API calls takes an Array of UIntegers ByRef:

Public Function Get_Values(source_id As Byte, first_value_address As Byte, number_of_values As Byte, ByRef valuesOut As UInteger()) As Integer

After the call, valuesOut will hold a list of values number_of_values long from source_id starting at first_value_address.

There is a hardware driven limitation that the max number of values returned is 15 regardless of requested length. I need to get 28 values into an array from my VB.Net code.

Is it possible to send only part of an array variable to the function similar to this C code?

uint[28] values;
Get_Values(0, 0, 15, values);//get first part
Get_Values(0, 15, 13, &values[15]); //get second part of data

View 3 Replies

Filtering Array To Return Subset Of Elements In .Net 2.0

Mar 2, 2011

I have the following in a .Net 2.0 app:

Private chequeColl() As Cheque
For i = 0 To m.Length - 2
chequeColl(i) = New Cheque()

[Code]....

I now want to make chequeColl only contain those items where Status is not equal to 41. In LINQ this would be easy but I can't think how to do it.

I cannot use the .Net 2.0 LINQ bridge products, I have to do this the old school way. At the end of it chequeColl must only contain those items that are not status of 41. I cannot have empty elements.

View 3 Replies

Get A Subset Of Unique Values In Column(1) Of A DataView?

Dec 16, 2009

Is there a way to get a subset of Unique values in column(1) of a DataView?

View 6 Replies

Select Subset From DataSet And Display In DataView?

Nov 3, 2009

I have populated a dataset from a text file and I can display it in a dataview. Can I and if so how do I, select a sub set from this dataset and display it in the dataview?

View 4 Replies

Why Isn't The Counter In For Loop Increasing Once For Each Found Subset

Nov 26, 2011

The program is to take an entered string then search for a subset of letters entered through and input box.In my subprocedure Sub btnSearch_Click I am using a loop to move through the entire length of an entered string to search for a set of letters entered through an input box. I can find the set of letters to search for but instead of increasing my counter "Found" for every instance of a match it returns the length of the string instead. I just don't know why the IF doesn't prevent the counter from increasing for every element in the string. I want the counter to increase only when the match is found. I just put 2 message boxes in there to make sure it found the right letter and then display the counter.

Here's the entire

' Name: Count Project
' Purpose: Displays the number of times a sequence of characters
' appears in a string.

[code]....

View 5 Replies

IDE :: Horizontal Slider Bars - Fit A Regression To A Subset Of Data

Jan 18, 2010

I have a set of x, eg 288, data values. The user wants to fit a regression to a subset of this data, eg (2 - 200), then she wants to analyse within a subset of this fitted range, eg at 20 and 100. So, on my form are four Hor. Slider Bars, to set the lower and upper bounds to the fitting and the analysis. The two that set the lower bounds work fine. The two that set the upper bounds are getting corrupted somehow outside of my code and I do not know how to solve this problem. What happens is that when I click on the right hand arrow on the slider bar, the program runs through my function with the correct values whilst the arrow is down, goes out of my code and then immediately comes back into my code, but with the wrong value set into the Hor. Slider Bar fields that I am working with, eg the .Value field. The new value is always 9 below the maximum that it can be, but I can see no connection to this number.

View 1 Replies

Io - Proper Way To Commit A Subset Of A Byte Buffer To File?

Dec 7, 2011

I am concerned that this code is copying bytes into a temporary buffer before writing directly to file.

I feel like there should be some method of copying bytes directly from the tail end of the main buffer directly to file.'this code copies all bytes starting at integer index from the main buffer into a new file: ga.exe

'declare temporary buffer
Dim EXEBytes(bytes.Count - index) As Byte
'copy subset of bytes over, starting at index
System.Buffer.BlockCopy(bytes, index, EXEBytes, 0, bytes.Count - index)
'write bytes from temporary array into file
File.WriteAllBytes(Server.MapPath("/BIN/ga.exe"), EXEBytes)

View 1 Replies

Create A .net Chart Object With A Series Based On A Data Subset?

Apr 8, 2012

I'm working in VS2010 on a visual basic application. It takes in serial port data, writes it to an access database, and then graphs the data.The data only comes in once every minute, so it's not like I'm building an oscilloscope. Right now, the chart is reading from the database using a table adapter and graphing just fine, so long as I keep the number of records in the database low.If I add too many records to the database, the chart shows a red "X" through it. I've played with changing the axes, but it is still a problem.I don't really need to graph the whole database.The twenty most recent records would suffice.How can I make a chart series with only a small subset of the database in it.Perhaps it cold be populated with a query?

View 1 Replies

Get Subset DataTable From Main DataTable, But Preserve Primary Key & RowErrors?

Apr 16, 2012

I came across a problem with using a BindingSource as my DataGridViews.DataSource. Whenever I applied a filter to a column in the BindingSource and the user makes changes that don't match the column filter the DataGridViewRows would automatically disappear. A similar thing would happen when applying a Sort to a column. If the user made any changes the DridGirdViewRows would automatically sort causing rows to be moved around. This was not ideal for my application and there isn't anyway to stop this from happening with the BindingSource.

To correct this issue I have to use subsets of data. I use a DataView to apply the filter and sort to the main DataTable, which creates the subset DataTable.The problem is when I use the DataView.ToTable method I loose the Primary Key and RowError information. So I have to reapply this information everytime the user filters or sorts the DataGridView.Is there a better way to get a subset DataTable?[code]...

View 10 Replies

.net - ActiveRecord Linq/NHibernate Linq Not Building Query Completely?

Jul 14, 2011

given this function:

Public Function Search(ByVal StartIndex As Integer, _
ByVal MaxResults As Integer, _
ByVal AccountNumber As String, _
ByVal LastName As String, _

[Code]....

instead of what I expected:

Select count(*) from remitline where lastname = "smith"

What am I doing wrong building up the where clause? I'm using Castle ActiveRecord 2.1

View 1 Replies

Performance Gain In LINQ Query Vs LINQ Stored Procedure?

Aug 6, 2009

if there is that much of a performance gain in running a LINQ stored procedure versus a LINQ query?

View 1 Replies

Linq To Entities. GetPropety(name).GetValue Not Recognised By Linq?

Apr 20, 2011

I have a listbox on my xaml form that I bound to a List(Of MyType) property. I populated this list like so:

Dim fields As List(Of CheckableFields) = New List(Of CheckableFields)
Using context As ITIPEntities = New ITIPEntities()
Try[code]....

Now I'm at the point where the user selects the fields they want included in a report and I need to iterate over the required fields. This is my linq query:

For Each checkedField In _requiredFields
If checkedField.IsChecked Then
If checkedField.FieldData IsNot Nothing AndAlso checkedField.FieldData.Trim IsNot String.Empty Then[code].....

View 1 Replies

How To Get Lamda In LINQ To Actually Filter For Dynamic Linq

Sep 10, 2009

Example-I have a person class

Public Class Person
Private _fname As String
Public Property Fname() As String

[Code]...

View 2 Replies

LINQ Query Using The Dynamic LINQ Library?

Mar 31, 2011

Forgive my ignorance on this.I have this LINQ Query:Dim ngBikersDataContext As New CarBikeWalkDataContext

bikersList = (From c In ngBikersDataContext.Reg_Bikers _
Order By c.L_Name _
Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _

[Code]...

with the error "Overload resolution failed because no accesible 'Select' accepts this number of arguments."
Over the "NEW" I get an error " ')'expected."

View 1 Replies

"System.ArgumentException: An Item With The Same Key Has Already Been Added." When Trying To Order An In-memory LINQ Query By A LINQ Association?

Jan 27, 2011

We are doing a query against an in-memory collection of LINQ data objects. The wrinkle is that we are ordering by a column in a related table whose records have not necessarily been loaded yet (deferred loading:)

Dim oPkgProducts = _
From b In oBillPkg.BillProducts _
Where b.Successful.GetValueOrDefault(Common.X_INDETERMINATE) = _

[code]....

View 1 Replies

.net - Linq Expressions With Linq To Entities?

Feb 28, 2012

The pattern I'm trying to avoid is checking if a string (normally a control's text value) is null/empty, and if it is, comparing it using Contains to a field in my data. Obviously the field isn't hard-coded into my extension, neither is the object type.What I've got works perfectly in Linq to Objects, but I get the generic run-time error "LINQ to Entities does not recognize the method 'System.String Invoke(GenericQueryHelper.Customer)' method, and this method cannot be translated into a store expression." when using an entity framework model.

Here's what I have:

<System.Runtime.CompilerServices.Extension()>
Public Function CompareAndFilter(Of T)(source As System.Linq.IQueryable(Of T), expressionField As System.Linq.Expressions.Expression(Of System.Func(Of T, String)), compareTo As String)

[code]....

I want my usage to look something like this:

Dim results = repository.Customers.CompareAndFilter(Function(c) c.FirstName, searchText)

I do need to get this running against a SQL database really, as it is filtering results, so I don't want to be doing that in memory.

View 2 Replies







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