I need to find all records where the status is in the local list of Integer's.
In SQL I would do
Where Status in (select i from my list)
But I can't figure how to make it happen in Linq.
ListData = New IssueTrackerEntities2()
Dim queryString As String = "SELECT VALUE CallList FROM IssueTrackerEntities2.CallList AS CallList"
Dim Status As New List(Of Integer)
This is probably a really basic question - but I have a list of items (custom objects) being passed from one winform (.net 3.5) to another. I want to create a local list to store changes that only get persisted if the user clicks save. Currently if the user clicks cancel - the changes are still applied in the first form because I assume the objects are reference type.I have the save working as it calls a service layer to do the save and then refreshes the other form - but not the cancel.
I received this error when i implement STE in EF4 and WCF "Object mapping could not be found for Type with identity 'NorthwindModel.Customer'."if I'm not using STE (in single project), this code is working.Walkthrough: Serialize Self-Tracking EntitiesHere is my code
I am working on a Visual Basic application that is returning Event Logs using WMI. I only want the latest 5 application, error events, but as I have the code now I get everything and then need to loop through and grab the first 5.
Dim wqlEventLogAs ObjectQuery =New ObjectQuery("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Application' AND Type='Error'") Dim objEventLogAs ManagementObjectSearcher =New ManagementObjectSearcher(myManagementScope, wqlEventLog) ForEach objMgmtAs ManagementObjectIn objEventLog.Get Next
I have tried a number of ways to add "Top(5)" to the query but each time I get "Invalid Query".
I am a Visual Basic 2008 user (under Visual Studio 2008) and I have numerous local variables in my project. How can I list them to a file or to a printer?
I know this topic is all over the place, but I am not doing an INSERT, UPDATE, DELETE. My statement is a plain and simple SELECT statement and so far has worked with 116 different items in my database until I got to one.
I have a search engine and am going through every single product in our database to add information to it. This is all done through the website, but when I search for ProductID 331 and click on it, it goes to the error page that says Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
It doesn't make any sense to me that the website would error with only this one product. This is the statement I am using. Does anyone know why 1 product would be causing this error?
WebService: Public Class ProductSearch Inherits System.Web.Services.WebService <WebMethod()> _
I get the following errors: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. If the subquery only return one result,then it works fine,but if the subquery return more than one results, then the error occurred,how can I resolve this error?
I'm looking for the code to list all users in the Administrators group on a local machine. I had something like that for VB script and I converted it to work under .NET but it's slow and not the thing I want.
Dim o_adsi_group As Object o_adsi_group = GetObject("WinNT://" & System.Net.Dns.GetHostName & "/Administrators,group")
IIS7 running on Windows Server 2008 R2. Development environment is VWDE 2010.
I'm setting up a simple "machine status" page to monitor a server. I want to display the Drives on the machine, including mapped network drives and show their free space, etc.
I'm using System.IO.DriveInfo.GetDrives() to return a collection of DriveInfo objects. I then itterate that collection to display the relevant information.
The issue I'm having is that only local drives appear. (A:, C: and D:) No mapped drives "Network Locations" appear in the collection.
I'm thinking it has to do with the user account that's executing the code (if that makes any sense). So if the code is executing under the user "ASPNET" (or whatever it is) the drives would have to be mapped under that user. As it happens, I have the server set up like a workstation and it logs in automatically under the user with the mapped drives.
What I've done:
- I have set the Web Site's Anonymous Authentication user to that same user
- I have set the Identity of the Application Pool to which my web site is assigned to be that same user.
SELECT EqID, MakeID, Model, Description, (SELECT MAX(EvDateEnd) AS MaxOfDateEnd FROM tblEvent WHERE (EqID = tblEquip.EqID) AND (Event = 'REG')) AS RegExpire,
[code]....
For example, I want to get the Max EvDateEnd from the Events table for each record in tblEquip, but not all records in tblEquip have the "REG" event, while others have multiple REG events.Some events (like EAE) I leave the tblEvent.EvDateEnd field blank to show the event is open and ongoing, such as issuing a vehicle to an employee(entity). when the vehicle is returned I enter the date in EvDateEnd essentially closing the event.
I've got a subquery that returns the most recent value from a child table. In some cases the subquery returns nothing. The query below fails at runtime because the inferred type of MemberPrice is decimal and is not nullable. [code]...
Using advWorksContext As New AdventureWorksEntities ' Call the constructor that takes a command string and ObjectContext. Dim productQuery1 As New ObjectQuery(Of Product)("Product", advWorksContext)
[code]....
An ObjectQuery can be enumberated only once. (Subsequent attempts at enumeration throw an exception.) The enumberation takes place in the for each statement. The problem is that if the query is empty attempting a For Each will throw an exception. But if I check for a count:If productQuery1.Count > 0 Then . . .
That eats up my one chance at enumeration. I could nest the For Each in a try/catch block and throw away the empty query exceptions, but that's ugly.
I have a button inside a one of my forms which contain a lot of coding and normally a lot of variables declaration.
Is there is a option/add-on that I can use/set that enable me to display all the variable used inside the sub or function I am currently working in?
All I can find is add-on to display the Properties/Methods and only Public variables inside the form or inside the class. but I need to list the local variables also.
I wrote some code to update the count of a field in a table, but it is very slow. So I'm trying to do it in a subquery to speed things up, but I'm not very good with subqueries. I'm getting the error "Subquery returned more than 1 value".
I want to use a stored procedure to populate a label on my asp.net page and a dropdownlist @tourname will be populated into a single label while @tourdepartures will be multiple dates, that i want in a dropdownlist however when i run my sp i get this error
I'm trying to query old Access database tables and compare them with SQL Server tables.They often don't have primary keys, or they have extra fields that had some purpose in the nineties, etc., or the new tables have new fields, etc.I need to find records - based on a set of fields specified at runtime - that are in one table but not another.So, I do this kind of query all the time in SQL, when I'm comparing data in different tables:
dim fields_i_care_about as string = "field1, field2, field3" 'This kind of thing gets set by a caller, can be any number of fields, depends on the 'table dim s as string= ""
[code]....
It tells me it can't convert a Boolean - Is there any way to do this without Linq expressions? They seem far more complex than what I'm trying to do here, and they take a lot of code, and also I can't seem to find examples of Expressions where we're comparing two fields in a subquery.Is there a simpler way? I know I could do the usual EXISTS query using JOIN or IN - in this case I don't need the query to be super fast or anything. And I don't need to use a DataTable or DataSet - I can put the data in some other kind of object.
Does anyone know how this can be done? The problem is that when you run the script to add a domain user to the local group as a local user you have no permissions to query the domain. Is there a way to pass a user name and password when doing this? [code]...
Im coding an application that needs to list all computers inside my LAN, and get the status of the machines ex. Power On, Power Off.. in order to Wake On Lan, or Turn it Off.. im using Visual Basic .Net.I all ready listed all machines, now i need to get the status of them..
II am trying to create a toggle button that switches a list to a range and then back to a list if needed. I am able to get it to do both but when I add an item to the list, convert to a range and then convert back to a list it leaves off the last items I entered.I tried to work in a code to select all cells but I must not be putting it in the right place.This is what I have so far:
In VS 2008, VB.Net, I am successful connecting to a local SQL Server (version 8) and seeing all tables/views/procedures in Server Explorer. The local OS is Win XP Pro SP3. I created an ODBC data source to a remote SQL server (also version 8) with a database of the same structure as the local one. The connection tests out ok. The remote computer runs Windows Server 2000 SP4. In the VS 2008 Server Explorer I add this ODBC source. When I click on the plus-signs to expand items, neither the tables nor the views show anything, whereas the full list of procedures appears. Is it the old SQL Server version? Is it the old Server OS version? Something else alltogether?
This is what I'm sure will be the first of many noob-ish questions from yours truly... I'm studying as a mature student for a Computing Degree (encompassing web design, hardware, programming and systems analysis). The programming seems to be my weak spot this year. I enjoyed C++ last year, doing basic console applications, but progamming visually with VB in Visual Studio 2008 I'm struggling!
Does link text mean I have to return a concrete implementation? Even though I am using svcutil with the /r that includes my entites(where IMyInterface is defined). I get no errors but it changes all List(of IMyInterface) to list(of Object) and I cannot deserialize it on the client
Error: list(of object) cannot be converted to list(of IMyInterface).
I'm looping all the properties in an object via reflection:
For Each p As PropertyInfo In values.[GetType]().GetProperties() If p.CanRead Then 'Do stuff End If Next
how to determine whether the property in question is a generic List(Of T)? If it is I need to loop the list itself.
I've experimented with GetType and TypeOf but have not managed to get anything working.
To clarify, I want to keep this generic. I do not want to specify the type of T, I need to loop the list items and call the ToString method on each item. T could be one of a number of different types (application specific reference types). Is it possible to do this without specifying types?
If I can generate a list of random integer with a click of the button and put the results in a list box using VB.Net but how do I randomly change several integer number generated by button 1 by clicking button 2? How I retain the results of button1 and change the results when clicking button2?I try before but the two button function code cannot relate to one another.