LINQ Equivalent For SQL Between Keyword?
Feb 12, 2010Is there a LINQ To SQL equivalent to the SQL between keyword?[code]...
View 2 RepliesIs there a LINQ To SQL equivalent to the SQL between keyword?[code]...
View 2 RepliesIs there a VB.NET equivalent to the C# var keyword? I would like to use it to retrieve the result of a LINQ query.
View 4 RepliesWe have a keyword 'app.path' in VB6 What is the equivalent key word in VB.NET
View 1 RepliesIn C# you can do this to make your member variable immutable: public readonly int y = 5; What is the equivalent "readonly" keyword in VB.NET?
View 1 RepliesI have converted the following C# code to VB.NET.But I am unable to find the equivalent of C# "Unchecked" keyword in VB.NET.Below is the C# Code and following the C# Code is converted VB Code.After conversion and building the VB Code I am getting the error :"Constant expression not representable in type 'UInteger'." [code]
View 11 RepliesIs there a Java equivalent - specifically on Android - for VB.NET's Static keyword? For those not familiar with VB.NET, take the following code snippet...
Sub MyFunc()
Static myvar As Integer = 0
myvar += 1
[code].....
how New works with the With keyword in this example from the MVC framework.
routes.MapRoute("Default",
"{controller}/{action}/{id}",
New With {.controller = "Home", .action = "Index", .id = ""})
I'm trying to convert something from C# to VB.NET and I'm having trouble finding an equivlent in VB.NET to C#'s yield keyword. I realize 'yield' is not a convertable keyword to VB.NET, so can someone please show me how I would implement this code in VB.NET. I got all of it converted over except for the implemented GetEnumerator() function. It is simply a class that implements CollectionBase and IEnumerable (to make it LINQ worthy):
[Serializable()]
public partial class Customers : CollectionBase, System.Collections.Generic.IEnumerable<BusinessLayer.Customer>
{
[code]....
I have the following query in VB, but I do not know how to translate it to C# synatax
Dim q = From c In db.Customers
Group Join o In db.Orders On c.CustomerID Equals o.CustomerID Into orders = Group
Select New With {c.ContactName, .OrderCount = orders.Count()}
Find the Linq equvalent on the below sql query:
select sum(weight) from (
select weight from pers p
join list l on l.persindex= p.persindex
group by p.persindex,weight) a
This is the query that I'm trying to reproduce:
[Code]...
Not sure if this is just a bad habit, or a valid way of doing things, but for large complex report queries spanning bunches of tables, I often get my aggregate stats by summing a Case statement.For example:
SELECT Contact.Name,
SUM(CASE WHEN Order.Type = 'Special' THEN 1 ELSE 0 END) AS SpecialOrders,
SUM(CASE WHEN Order.Type = 'Magic' THEN 1 ELSE 0 END) AS MagicOrders,
[code].....
Some long-gone developer left the following LINQ query behind with no documentation and I'm struggling to understand what it does (and therefore if it's doing it right), either by breaking it into pieces or providing the SQL equivalent?
CODE:
I am struggling in particular with the Group Join and Into TargetMatches = Group pieces:
CODE:
I need to check if a given object implements an interface. In C# I would simply say:
if (x is IFoo) { }
Is using a TryCast() and then checking for Nothing the best way?
I'm trying to translate some C# LINQ code into VB.NET and am stuck on how to declare an anonymous type in VB.NET.[code]How do you translate C#'s new { ... } syntax into VB.NET?
View 2 RepliesI'd normally do this in C# but since I've got to get this code in this particular assembly which is a vb.net one, I'm stuck.
Here's my linq query:
Dim i As Integer = 0
Dim oldAndCurrentIntersectionOnNames = From currentApplicant In currentApplicants _
Group Join oldApplicant In oldApplicants _
[CODE]...
You'll see the .Index = i+=1
This was my attempt to do what I'd quite happily do in C# (i.e. Index = i++) in VB. Unfortunately the VB compiler doesn't like that. how I'd do this in VB.
Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub
In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?
Possible Duplicate: WITH statement in Java? does anyone know if there is the With Keyword in Java?
View 4 Replieswhy use of namespace and use keyword and declaration of namespace
View 1 RepliesPossible Duplicate:Default value for generics k so while translating some code from c# to vb, i came across the default keyword, and I'm simply replacing it to nothing.
View 2 RepliesIn my current project everyone names variables and methods after what they are and what they do. This is good for quickly understanding the code, but with a lot of long varible names comes some headaches, such as when copying a dataset to an entity/object. So, while you understand the code, the readability still takes a blow.
veryLongVariableName.Id = datasetVeryLongVariableName.Id
veryLongVariablename.Something = datasetVeryLongVariableName.Something
etc.
Using VB.NET's With keyword can help.
With veryLongVariableName
.Id = datasetVeryLongVariableName.Id
.Something = datasetVeryLongVariableName.Something
End With
Now, my question, is there any way of using With, or something similar, but for several variables at the same time? Something like:
With veryLongVariableName As a, datasetVeryLongVariableName as b
a.Id = b.Id
a.Something = b.Something
End With
I'm all for descriptive naming conventions, but they do tend to clutter things. Especially in VB!
I m trying to create a software in vb.net for some genealogists to trace their ancestors History, the users will search for the document in 3 ways
1. reference number from a combo box.
2. By the title of the document.
3. by inserting a keyword from the documents abstract..
i have already loaded the picture. i hav put all in one note pad my reference no., on next line i put my abstract and on the third line i put my path where the document is located.in coding i put all in different array.... making the program read all one by one line wise.i want to make search thru the keyword... means wen user inserts a key word in the textbox the program read all my abstract and then in a drop down it should display the documents that match the keyword.
Its work well in windows 7 but when i run project in windows xp its says i must use New keyword but when i use New its gives error at regkey.GetValueNames and RegistryKey = Registry.LocalMachine and regBaseKey.OpenSubKey("SOFTWAREMyApp", FalseImports Microsoft.Win32[code]...
View 4 Repliesin C# you'd put a @ in front of a reserved keyword. Is there any equivalent in vb .net?
View 1 RepliesI have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.
How can i implement a class like:
[code]...
If i do this, the word 'error' is invalid.
I use the Call keyword when calling subs in VB/VBA. I know it's optional, but is it better to use it or leave it off? I've always thought it was more explicit, but maybe it's just noise. Also, I read this on another forum: Using the Call keyword is faster because it knows that it is not going to return any values, so it doesn't need to set up any stackspace to make room for the return value.
View 4 RepliesFirst off let me say that I am essentially new to VB.NET, i.e; still learning. Also, I hope that this is the right place to post this question. In a Project I have a Class module defined as:
Public Class Def
Public Id As String
Public Meaning As String
[Code]...
I have to inherit some legacy code in company, which is written in Visual Basic.NET 7.0 (Visual Studio.NET 2002). I don't have much experiences in VB.NET, and this line of code gets me in trouble:
Public Class Global : Inherits System.Web.HttpApplication
Visual Studio gave this error: Error 31Keyword is not valid as an identifier.C:Documents and SettingsAdministratorDesktopPOManWebApplication1Global.asax.vb414C:...POMan
What is this keyword how can use it?If Page.IsPostBack = False Then
View 3 RepliesI generally use to organize codes below lines;
#Region "Comments.."
#End Region
But when I want to use it in the Function, it gives error ("..are not valid within..."). Are there any keyword to make this in the Function or there aren't? [Code]