VS 2008 LINQ Not Returning Results?
Mar 3, 2010
So, I'm not really sure if I have this setup properly or not. This is my first attempt at utilizing LINQ and I am trying to return data directly from an XML file.Here is my XML structure:
<folder_list>
<folder lbl="_localhost" abs="C:\_localhostapache2triadhtdocs" unc="C:\_localhostapache2triadhtdocs" tag="default" />
<folder lbl="Programming" abs="D:\_prog" unc="D:\_prog" tag="default" />
<folder lbl="Anime" abs="D:Anime" unc="D:Anime" tag="default" />
[Code]...
View 9 Replies
ADVERTISEMENT
Mar 5, 2011
I have a query using LINQ-to-SQL. It queries an underlying database table Rooms. It uses Where conditions to narrow down the results, namely:
Gender.Current Occupancy < Max Occupancy Available Flag is Checked I know this should return results but it keeps returning an empty set.Code is below
[code]...
UPDATE: I've verified that the issue is with the statement where sh.is_available = 1, which doesn't make sense since this is a bit field.
View 3 Replies
Jul 20, 2011
I'm doing some XLINQ in VB for work. I basically need to pull some values from a small chunk of XML as listed here:
<?xml version="1.0" encoding="utf-8"?>
<Fields>
<typeQtyRadioButtonList>1</typeQtyRadioButtonList>
<cmbQtyCheck>Reject</cmbQtyCheck>
[code]....
... Leaving out the implementation of the For Each loop....So I have stuck a break point on the for each and the collection has no elements in it.
View 1 Replies
Nov 17, 2010
We are noticing this occurs BOTH in javascript and in VB.net 2.0. So basically both in server side and client side code. Basically if you run this equation 975328 - 153279.43 you get the following answer 822048.57000000007. However, if you run 975328 - 153279.4, 975328 - 153279.433, or 975328 - 153279.5 everything is returned correctly. WHY the system calcuates the 975328 - 153279.43 with an answer with 11 decimal places? Not to mention adding the 7 in the 11th decimal place, thus making the equation answer incorrect.Of course I know I can trim, set the answer to appropiate decimal places, etc., etc.the above is proven by just entering the equation into the immidiate window, thus ellimnating varibables such as object types, etc., etc.
View 3 Replies
May 18, 2010
I have been having an issue with returning records from a SQLServer database where the date the record was created is between 2 user specified dates. When I populate the DataGridView with the results, they are incorrect and do not follow any recognisable pattern.
For example, if I specify the dates 05/05/2010 and 12/05/2010 I get the attached data in the DataGridView.
Code:
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
'Clear the DataGridView
[Code].....
View 3 Replies
Mar 5, 2011
I am pulling a date value from my database:
Dim qfresho = From p In dbConfig.Configs _
Where p.Description = "FROD" _
Select p.dateValue
Dim qfreshc = From p In dbConfig.Configs _
Where p.Description = "FRCD" _
Select p.dateValue
Then comparing these date values to the current date:
[Code] .....
But for some reason its always returning the Else condition - even though the values in the database should make the query true. I'm guessing for some reason its not pulling the results as a date?
View 3 Replies
Apr 5, 2011
I have a GridView which is showing results and from which I am deleting a result using the auto-created delete link. My code behind to remove the row and associated info. is:
Private Sub GridView1_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
' The deletion of the individual row is automatically handled by the GridView.
Dim dbDelete As New pbu_housingEntities
' Remove individual from the bed.
[Code] .....
It seems that it is not able to grab the row that is being deleted, so it is always giving me a "Object reference not set to an instance of an object" error.
View 1 Replies
May 7, 2012
like an Interop user control (VB.NET) to return and to accept multiple values from a get/set call. I assumed a user defined type (UDT), would be the correct way but I keep getting a "Variable uses an Automation type not supported in Visual Basic¯ from the VB6 compile. How is passing multiple values between an interop control and the VB6 application done?VB.NET (Interop) code, a control with a .NET ListView
Structure Employee
Dim Firstname As String
Dim Lastname As String
[code].....
View 2 Replies
Mar 11, 2010
Im currently working on an n-layer application that does alot of database work.90% of all database queries are updates, and inserts and I want to be able to view the results of my query in the presentation layer.I was thinking of creating a QueryResult class that has a few properties like QuerySuccessful (boolean), Message (string) - holds success or error message, and optional field to hold any additional data that may need to be passed back to the presentation layer.So I guess my question is, am I going about this the correct way by creating a QueryResult class, and passing that back up through the layers to my PL?
View 2 Replies
Mar 30, 2009
I have a problem which I have tried to solve in several ways, and by searching the Internet for various terms, searching through books and Visual Basic instructional videos, but none have yielded the correct results. My goal is as follows:
1. Create a Database listing job names, job numbers, and a link to the file about the job.
2. Create a form with 2 text boxes, a search button, a box to display results, and a preview panel.
The two above steps have been completed. The following is where I get stuck
3. I want to search for either the job name, and/or the job number, have VB search through the database and return the results in the results box.
4. On clicking on one of the results in the result box, the preview panel will show a preview of the file.
Notes:
i) The files being linked top are Microsoft Excel files.
ii) The box I have used for the results currently is a listbox, though I've no idea if this is the correct choice for what I want to do.
iii) The database I created is an *.xml database created in Visual Basic. I am a fair beginner to VB, learning as I go, but I'm stumped as to how to achieve this so any pointers on how to achieve points 3 or 4
View 2 Replies
Nov 25, 2011
I have been taking a class in Visual Basic and am currently working on my final project which I am having some trouble with. I am using Visual Basic 2010 express The project is to create an application that will store data in a text file, specifically, Last Name, First Name, Customer Number, Address, City, State, ZIP Code, Telephone Number, Account Balance, and Date of Last Payment. I have gotten everything done except the ability to search the file by Last Name or Customer Number. I have no idea how to go about this? I was thinking of ways to use indexof or Readline to be able to search the data, but I'm not familiar enough with the code to come up with a good solution. Below is a picture of how my form looks..As you can see, I'm currently using 2 separate forms to get the data from the user. Here is the code for Form1 which is the "Customer Accounts" form in the picture.
Imports System.IO
Public Class Form1
Public customerFile As StreamWriter ' Object variable
Public customerFile1 As StreamReader ' Object variable
Public strFile As String
[Code]...
There isn't enough room to post the code for my secondary form, but you get the idea. I would like to be able to enter a search term in the textbox on the bottom right of the form, and either search the data as its displayed in the listbox, or search the actual file? I was thinking that the results would be displayed in a messagebox?
View 3 Replies
May 23, 2011
I am working with a method using LINQ to XML to return a string.This is the XML
<data name="lnkViewResultResource1.Text" xml:space="preserve">
<value>View results</value>
</data>
[code].....
View 3 Replies
Feb 23, 2011
I have a Search web reference (from a Search Server 2010 express install) in a vb.net application that is utilizing the QueryService Class to search a production Sharepoint foundation 2010 site.At a previous point in time, we had created a proof of concept on an entirely test system that has since been turfed. From my recollection on this test system when documents were uploaded as a specific site content type (that inherits from document) and metadata was provided, we could search for specific metadata by making managed properties for each, and search results would be returned as documents (with the isdocument flag set to true). Viewing the document then became simple, as we could simply use the filename and path to display the stored file.Now we are developing a production system and we have encountered a new behavior, where these results now are returned as aspx results such as
[URL]
This of course makes it terribly difficult to locate and view the document, we can extract the Title which will then give us the name of the file with no extension, but that hardly helps, as the FileExtension data is aspx, not the documents file extension, so we don't have a full filename. We could display the page returned as a result, but would much prefer the document itself.
I've made a test document library, with just bare bones setup, (not using the site content type, or site columns) and uploaded some documents on the same site, and they are returned in the same fashion, so I don't believe the document library, or content type are the issue.
With a fairly limited understanding of both Sharepoint and Search Server, I don't know if this is a setup issue with the search service itself, with the site configuration, or with the querypacket I am sending. We also have a third party application (Knowledgelake) installed on the server that ties into sharepoint which could have changed configuration somewhere as well?
I don't think the query packet has changed since it was working in the proof of concept, other than the custom data column names. I will provide it here in case there is something glaringly obvious to an external reader.
<QueryPacket xmlns='urn:Microsoft.Search.Query.Document'>"
<Query>
<SupportedFormats>
<Format>urn:Microsoft.Search.Response</Format>
[code]....
View 1 Replies
Jan 22, 2010
I have the follow Linq query that is in a web application that was converted from .NET 1.1 to 3.5:
dim objListOfFilteredDataRows = from datarows as datarow in objDataSet.tables(0).rows _
where datarows("SomeColumn") = SomeValue
I have the exact same query in an application that was created using .NET 3.5 and the query returns an IEnumerable. However the query in the converted application is returning:
{Name = "WhereEnumerableIterator`1" FullName = "System.Linq.Enumerable+WhereEnumerableIterator`1[[System.Data.DataRow, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
**Edit: When I highlight the expression, the intellisense says that it doesn't know the type of objListOfFilteredDataRows and assumes its a type of "Object". Why is the type not infered in the converted 1.1 application but is infered in the "native" 3.5?**
What am I missing here? How do I convert the "WhereEnumeratorIterator`1 to an IEnumerable?
View 5 Replies
Apr 28, 2011
Just a quick question about LINQ, I want to use a value from the returned dataset to lookup a value and return this. The line I am struggling with is .ViewingNotes = NewViewing(pt.ProspectId).GetViewings().Columns(7).ToString(). Is this possible?
With BusinessLayerObjectManager.Context
Return (From p As [Property] In .PropertySet
Join pt As Prospect In .Prospects On pt.Property.propertyID Equals p.propertyID
[code].....
View 1 Replies
Nov 18, 2010
I am finding this weird issue. When I do this > activities.Where(Function(a) (Not a.IsDeleted And a.ParentId = 100) It returns an in-memory query & when I try opening it up, it throws a object not set exception. This only happens when there were no items which satisfied the condition. Shouldn't it be returning an empty set? When there are items satisfying the condition, then it returns a list & works all good.
View 1 Replies
Mar 11, 2009
Any best approach to what I'm trying to achieve (linq to sql, returning list of data to show in a grid/list etc etc)... Its complaining about anonymous type conversion, and from what I'm reading, thats not elegant way of doing it.
Public Function GetHistory(ByVal historyId As Integer) As List(Of ?????????)
Using dc As New myDataContext(Application.GetConnection)
Return (From t In dc.ActionTypes, a In t.MyTable Where a.HistoryID = historyId Select a.ActionOn, a.ActionBy, t.Description, a.ImpactedItem, a.ActionDescription).ToList
End Using
End Function
View 4 Replies
Mar 8, 2010
I have got an xml document which looks something like this.
<Root>
<Info>
</Info>
<Info>
[Code]...
How can i write a linqToXML query so that it returns me an IEnumerable containing each child element, in this case all five child elements of , so that i could iterate over them. The order of child elements is not definite, neither is number of times the may appear.
View 1 Replies
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
Sep 9, 2010
I am using LINQ queries inside a WCF service to return data to a Silverlight frontend. Problem is the columns being returned using LINQ are in alphabetical order and I want them the way they are ordered in the database instead. Does anyone know how to stop the alphabetical ordering of column names?
View 4 Replies
Jul 13, 2011
Ok i have a query i use to parse an xml file to get an id number of a movie that allows me to get more detailed information about that movie from a database.Now the problem is the id is returned correctly with xml files stored on my hard drive (c:\desktop\movies)but when i try and parse an xml file on an external drive it dont get a hit on the <id>1123</id> node.
query
Function movieID(ByVal directory)
'Get the movie name
[code].....
View 2 Replies
May 17, 2010
I've got some code to try and loop through LINQ results, but it doesn't seem to be working.
HERE'S THE CODE
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
''# the page contenttype is plain text'
[Code]....
View 1 Replies
Sep 11, 2009
I have used linq quite abit but was just wondering how to append the results of two IEnumerable(of X) together into one IEnumerable(of X)
View 4 Replies
Oct 8, 2009
Before LINQ I would have my main application return the results of a SQL query into a dataSet. I would then transfer the dataset as a parameter to the external dll. Now I am bringing through a LINQ to SQL query that is returned as an IQueryable(Of vClientTable) object. I want to be able to transfer that set of vClientTable results to my external dll in order for the dll to work with the data included in the results.
I am probably doing it all wrong as well as trying to do it all wrong, but would like some advice on what would be the best method to use.
DB Query
Public Shared Function getClientData(ByVal clientID As Int32) As IQueryable(Of vClientTable)
Try
Dim r = From p In dbLINQ.vClientTable _
[Code]....
Obviously in the external dll it has no idea what an IQueryable(vClientData) object is and even if I create a dbml file and datacontext in my external project for the dll that includes the same class to the DB table/view it still says that the objects are different types.
View 4 Replies
Mar 10, 2011
Just when I was thinking that I had Linq To Xml sussed I'm faced with yet another error! I think if I was to understand the linq search process in general better I might have more success, so any good links regarding that are also welcome. To my problem however; using the code below:
[Code]...
View 1 Replies
Oct 17, 2009
I'm having trouble populating an object from an XML file. I've copied an example I've found almost exactly, with variable names changed, but I keep getting the "Enumeration yielded no results" exception.
Here is my code:
[code]...
Essentially, the XML query is supposed to return the title and the description for every Property which has an element called Language Code, which is equal to "en-us". I have a feeling that my problem lies in my XML code, but I've been stuck here for a long time now.
View 5 Replies
Mar 3, 2009
I have the following code:
Dim db As New linqclassesDataContext
Dim categories = (From c In db.faq_cats)
NewFaqDropDownCategory.DataSource = categories
[code]....
View 3 Replies
Jun 10, 2012
I'm trying to return a single object from an array of objects with linq.[code]...
View 2 Replies
Feb 3, 2011
In my application, I have a search query textbox (txtSearch) that works well with one-word queries with the following LINQ:[code]So how would I make the above query more generic (ie: able to handle any number of words in a query)?I should note that the object being queried is a List of strings pulled from an Access database. As it stands, this application only queries the database once and I'd like to keep it that way if possible.
View 3 Replies
Nov 8, 2011
I have the following xml:
<Root>
<Result img="1.png" name="a">
<Programs>
[Code].....
What is wrong with linq query. Why does a 1 work but a 2 does not? I would also like xml structure preserved after filtering.
View 1 Replies