Use LINQ In Vs2008 Using .net 2008?
Aug 4, 2011send me a little desktop application using vb.net and sql server in which LINQ concept is cleared, how to use LINQ in vs2008 using vb.net 2008
View 3 Repliessend me a little desktop application using vb.net and sql server in which LINQ concept is cleared, how to use LINQ in vs2008 using vb.net 2008
View 3 RepliesI had a support reply saying I needed to have VS2008 SP1 update installed. I clicked the About menu item for VS2008 and it shows SP1 under Microsoft .NET Framework Version 3.5 SP1. But on the left side for Visual Studio 2008 there is no SP1. Is the framework what they are referring to?
View 5 RepliesI have a Linq-to-SQL class diagram in my web application containing the two tables in my database (held in a DBPro database project in the same solution). All was working fine yesterday. I start doing some work tonight and note that the solution compiles fine in Visual Studio, but when I run the web app I get a compilation error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'FrostAlertDatabaseDataContext' is not defined.
[code]....
Is it possible to display my publicated program on an extern display?I know this is really difficult, but I thaught maybe I can put the program on a PIC and connect the PIC with a display.Problem is I have no tools to program a PIC, but if possible I'll search a solution for that. (I think you can let the PIC program
View 4 RepliesI have an ExtendedDateTimePicker control on my form. When I attempt to change the "ShowCheckBox" property to true, VS2008 stops responding and eventually exits the application; losing any unsaved changes.
I then tried to changed the property in code and the same result.
I want the control's value to be blank when it initializes.
Anyone know of any examples on creating plug in's for VS2008 - preferably with VB.net?
View 1 RepliesHow do I go about importing existing Crystal Reports to a new VS2008 project?
View 1 RepliesI just upgraded a project from VB 2008 to VB 2010. Before, the project did not use LINQ. I have started implementing it. So, I have updated the target framework from 2.0 to 3.5, and added a reference to System.Core, and imported the namespace System.LINQ to the entire project and also imported System.Data.LINQ into the form I'm working with (because it was not available in the list for Imported Namespaces in the references tab).
It's not throwing any errors now, but my IntelliSense is not working for LINQ stuff.
For example... I write this:
[CODE]....................
Then, if I type S. on the next line, the IntelliSense doesn't grab what it should for S (Only get Equals, GetHashCode, GetType, ReferenceEquals, and ToString, instead of the options I should get like Count, First, FirstOrDefault, etc...). If I Type S.First. then its the same thing, no IntelliSense that lists the available fields for S, just the standard options (Equals, GetHashCode, GetType, ReferenceEquals, and ToString). I should be seeing my column names in my table when I type S.FirstOrDefault.
So any ideas what is going on? When I type the code, for example, MessageBox.Show(S.FirstOrDefault.FirstName), it works perfectly. But it doesn't change the casing of the text (so it would read s.firstordefault.firstname) and no intellisense while doing it. But no errors. BTW - Everything works perfectly when creating a NEW VS 2010 application, it's just my projects upgraded from Visual Basic 2008 that have this issue.
if there is a Linq way of doing a TOP to only select part of a datatable? Unfortunately the data won't have it's key yet at the point that I need to do this (in fact, it's the key that we are trying to get back to in the end) so I can't use a where clause that looks at the key and gets the items between a range. Looking for something that's is the equivelent to SELECT TOP 1000 a,b,c FROM ABC ... but in Linq.We're using Linq to XML to transform a datatable to xml, then send it on over to SQL Server for processing. That works fine and dandy - and amazingly fast.
How ever, I've run into a problem where my datatable has an unusually high amount of records (for the type of data that it is). I need to move data on the order of 60k records to the database at some point. currently we're looping through the DT and calling the sproc.... if I did the numbers right, that will take somewhere around 33 hours... easily not an option. Ok, so our best option is to transform the DT into an xml document and send it off, then deal with the data in set transactions. Problem is that I just can't see us sending 60k rows worth of data all in one shot like that....
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
if there is that much of a performance gain in running a LINQ stored procedure versus a LINQ query?
View 1 RepliesI am loading al lot of data from a server to a local PC. Then i crate a disconnected table localy and move data from the server to the local PC.Then to update the userinterface (Wondows forms datagridview) i think i will use Linq ti move from this local tabel to the datagridview. On server there is 1000 000 rows in first tabel(source), to the user i have 30 000 rows each time the user loads forms and greate a smaler local table.That is once a day. But each time the user move to next row in datatabel there is 12 rows from my local table who is printed into the a new datagriview.How do i connect Linc to my ado table ?
View 2 RepliesThis is an extension of my last question which was answered, so I am starting a new thread. I have a query in LINQ that I was given to trim down the columns of a datatable. This works well, however, I need to make the LINQ query dynamic. So the query below:
Dim qColumnsIWant = From row As DataRow In inDT.AsEnumerable() _
Select _
EPN = row.Field(Of Integer)("EPNID"), _
EPNID = row.Field(Of String)("EPNNumber"), _
Ingot = row.Field(Of String)("Ingot"), _
ShopOrder = row.Field(Of String)("ShopOrder")
it works absolutely perfectly. I add nodes to the xml document, then I add child nodes using linq query to pull data from a datatable.My problem is. After the LeanerBiographical Node I want to add another node, but when I try the code i higlighted in blue, which needs to go in after the code highligted in red I get this error:Range variable name can be inferred only from a simple or qualified name with no arguments.for the life of me I can't get tgis to work and I need it on Friday. plz plz help me LINQ experts
[Code]...
I have seen different examples in Linq and one used Select and another didnt but both return the same results. Is there a reason why we should use Select ?
[Code]...
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].....
I am curious as to the proper technique to use SQL Server's AppRole with a LINQ to SQL Class. I understand I have to establish the intial connection with no connection pooling. However, do I simply call the SQL stored procedure sp_setapprole using standard LINQ before executing any of my methods that interact with the database, or is there a better way to enable and use AppRole within the LINQ to SQL class?
View 6 Repliessyntax of the LINQ query to use GROUP something BY something and select some fields of the datatable. i am having a datatable filled with some rows, i am trying to fill the datagridview with the GROUP BY query output of some fields.
View 4 RepliesI'm just getting my feet wet with LINQ but am struggling to convert this SQL statement to LINQ.
Dim SQLString As String = "SELECT MESSAGE_ID FROM " & Schema & _
".PPM_TRANSFER_EMAIL WHERE TO_CHAR(IMPORTED_DATE,'YYYY/MM/DD') <= '" & _
DeletionDate.ToString("yyyy/MM/dd") & "' AND IMPORTED = 'Y' AND FILE_NAME LIKE '" & _
mb & "%'"
I have a Dataset that already contains all the data from the PPM_TRANSFER_EMAIL table so it seems silly to query the database again when I can use LINQ to query the dataset.
In this following
[code]...
in the query creation part,the evensQuery and num are not defined.....then how does it work Secondly,i read this from MSDN:In Visual Studio you can write LINQ queries in Visual Basic or C# with SQL Server databases, XML documents, ADO.NET Datasets, and any collection of objects that supports IEnumerable or the generic IEnumerable<(Of <(T>)>) interface Now how can i know whether the collection of objects supports IEnumerable<(Of <(T>)>) interface or not?
I'm a bit of a n0ob to all this and I'm having trouble finding good resources on the net.What I'm trying to do is define a one-to-many relationship between two entities. I'm using the GUI tool in Visual Studio - and have created the tables in Microsoft SQL Server Management Studio.Basically, I have two tables....a 'Users' table and a 'Sites' table. A single user can have many sites associated with it.Users has a primary key of 'UID' and the Sites table as a primary key of 'Site_ID'.Sites also has a column 'UID' that should indicate which user that site is associated with.Anyway - it sounded pretty simple; but no matter what I attempt to do, I can't seem to get it to work. Mostly, I get validation errors - sometimes run-time errors, or sometimes, no actual data even though there should sites that match the UID of the user.I am able to connect and write LINQ against my Users table/pull down User objects - but can't seem to get it to know that the Sites are associated with the user.In the GUI - if I go to 'Add Association' and create a 1 to many link between Accounts and Sites - and Validate - I get an error saying, "Error1Error 11008: Association 'AccountsSites' is not mapped."
It seems like, when I try to make an association, it wants to link the 'Keys' of each entity.But U_ID and SITE_ID are the keys and, obviously, shouldn't match.If I click on the line it created in the GUI and I go to 'Table Mapping' I can see that it is trying to match those keys. Since I want it to match user_ids my first thought is to just make the U_ID the entity Key in the Sites entity but, of course, that's wrong because it would no longer allow a 1 to many relationship.
vb
Dim CheckedRows = From dgv As DataGridViewRow In Me.DataGridView4.Rows _
Where dgv.Cells(0).Value = True _
Select New With {.a = dgv.Cells(1).Value, .b = dgv.Cells(2).Value}
my code above works fine but how to get the index of the row on which the checkbox is checked
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]...
some of the xelements within the query were calling for tags that didn't exist in the original xml, heres a simple example of what i mean.
element = _
<xml>
<object>
<string>someString</string>
[code]....
So how do i change the querry so that it wont produce a null error if the tags asked for are not present.
q1/ how can i convert a lowercase string to sentence case with LINQ, without losing my rtb formatting?
View 2 Repliestranslation of the following C# Linq Expression (in VB.NET 2008):
syncContext.Send((obj) => eventToBeFired(this, new EventArgs()), null);
Is used in this subroutine:
private void FireEvent(EventHandler eventToBeFired)
{
if (eventToBeFired != null)
{
[code]....
I've been having this niggling issue that's been driving me nuts. Maybe there's something I'm not doing quite right, I don't know. I'm hoping someone with more experience on the subject can show me a better way or just confirm this with a "Jenner, you're not nuts, that's just the way you need to do it".The problem is this. Every time I try to use LINQ to enumerate a Collection, and for this example, I'll use a Collection of TreeNodes in a TreeView control; I get an error of:
Option Strict On disallows implicit conversions from 'Object' to 'System.Windows.Forms.Treenode'.
for the following
[code].....
I've become undone when trying to convert xml linq query result to a datagridview (see code below), needing some pointers,.
Dim doc As XDocument
doc = XDocument.Load("C: empxmltest.xml")
Dim query = From c In doc.<quotefile>.<quote> _
[code].....
I encountered something like a logical error which I could hardly resolve since I'm new to this technology. I'm using visual basic 2008 express edition with its built-in linq-to-sql technology. I was able to retrieve, add, edit, and delete such record using the linq-to-sql method, but one thing.I could not get is something like relational database operation. Here is my problem. As you can see the table above which represents the records on my database. You can notice there some account numbers that were duplicated which I used as the primary key or identifier. What I want is when I'd like to query such account number it should display all the records that have the same account numbers on it. Say for example, if I query the account number 00003. It should only pull up and display three records with the name Maverick and their corresponding address, movie rented and date.What is happening in my end is when I query such account number which are being duplicated in the database I encountered two things, its either it would display all the records in the database with different account numbers associated or it gives me an error message if I change my code from 'For Each memrec In db.Table3s' to 'For Each memrec In retrn' statement.What I've been trying to do here is if you enter the account number on the search box, it should only display the records on the combo box associated with the account number being entered. Like if you enter 00003 on the search box, it should only display the three movies rented by Maverick no more no less on the combo box. [code]
I have already tried that set of codes before but it's working the same thing. I tried many times modifying my codes before I posted my comment in this forum thinking that i can resolve it on my own but I wasn't able to. That code won't still filter the records in the database. I would like to verify that the table above is only representation but the real column on the table on my database is 'Account#' not Account Number and visual basic would detect the code as 'Account_'. May i know why Movies_Rented column on my table is not a member of string? Why is it the code you gave would still display all the records on the combo box? this is what im not getting. hope you can still find the solution to this issue.
I have one large XML file from one of our vendor and I am trying to pars it using Linq but it looks some wrong logic I am using.
This is xml file:
HTML
<Psw xmlns="http://localhost">
<exid>20</exid>
<Mes><Me>
<doc><ps>
<ghder> .....
The code I am trying:
Dim doc As XDocument
doc = XDocument.Load(TextBox1.Text)
Dim qList = (From xe In doc.Descendants.Elements("ghder") _
Select New With { _
.mid = xe.Element("MId").Value, _
.cdate = xe.Element("cD").Value _
' As well I need to get the value for pn child attribute }).FirstOrDefault
MsgBox(qList.mid)
Error for DBNull ' Object reference not set to an instance of an object.