Well, my VB is a little rusty, but I think this will work Dim result = From myRecord in myTable _ Select field1, _ field2, _ guidField = System.Guid.NewGuid().
Well, my VB is a little rusty, but I think this will work... Dim result = From myRecord in myTable _ Select field1, _ field2, _ guidField = System.Guid.NewGuid().
I think it should be: guidField = System.Guid.NewGuid() But, thank you very much! – Jeremy Sullivan Jun 3 '09 at 17:21 Right you are. I used to be a VB6 Jedi, but then I discovered c# and went over to the dark side.
:) – Robert Harvey? Jun 3 '09 at 17:27 I'm moving to C# right now as well, but most of my code is still in VB. Net as a result of my past experience.
I still think in VB, though. I'm trying to shake that. :D – Jeremy Sullivan Jun 3 '09 at 17:39.
In the Select clause of your Linq query, you should be able to insert a GUID like this: var result = from myRecord in myTable select new { field1 = myRecord. Field1, field2 = myRecord. Field2, guidField = Guid.NewGuid() }.
Thanks, Robert. How would I do that in VB. Net?
– Jeremy Sullivan Jun 3 '09 at 16:30 new Guid() will always return 00000000-0000-0000-0000-000000000000. You need to use Guid.NewGuid() instead. – Drew Noakes Nov 7 '10 at 22:55.
I've found some articles about using the RandomView view and the GetNewID function to pull back randomized records, but they are using this method with Linq to SQL which allows Functions and Stored Procs to be used with no return value or a scalar return value. From what I understand, a Stored Proc has to been returned as one of the Entity Framework objects from my generated model. I have been able to get that to work as an object, but not returning a scalar or no return set.
What I want to do is to simply add a column to my Linq query that contains a newly generated Guid so that I can order by the new Guids and take a specific number of records randomly. Can anyone help with some sort of lambda expression or join that would enable me to do this? It seems like it should be something built into EF, but I understand that we are on EF v1.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.