Showing posts with label 2008. Show all posts
Showing posts with label 2008. Show all posts

Thursday, December 18, 2008

Linq Where not exists query

Today I needed a where not exists query in my linq to objects.

Fortunatly I found it using the google :)

Suppose we have 2 lists, the first of a dummy class with properties Id and Name, the second of another dummy class with properties Id and Color (just so they are different)

We can perform a 'where not exists' query as follows :

var OnlyInFirstQuery = (from item1 in list1 select item1.Id)
.Except
(from item2 in list2 join list1Item in list1 on list2.Id equals list1Item.Id select item2.Id);


This will give us a list having only the items in list1 that do not exist in list2, just as I needed.

Tuesday, August 26, 2008

Linq To SQL Stored Procedure returns an Int

Today I was using Linq To Sql to execute a stored procedure wicht returned results by using a temporary table and dynamic sql (not my stored procedure)
Suprisingly enough when I dropped the procedure on the dbml file,
it generated a function with the return value typed as integer.
As it turned out, linq to sql and temporary tables don't play nice.
And since the database was a sql 2000 db, using table variables was not possible.

The solution turned out to be simple enough,
replace the stored procedure with a dummy one that returns the fields your normal procedure will return (names and type).
Then drop this stored procedure on the dbml file.
This will generate the correct return type for your procedure,
then simple alter the stored procedure to the correct one.

Hurrah, we can now use linq to sql to use our difficult stored procedure.

Thursday, February 14, 2008

Connecting to an Access Database in Visual Studio 2008 Server Explorer

Trying to connect to an MS Access DB from the visual studio 2008 Server Explorer gave me a little surprise to see that the window I got to create the connection only gave me the possibility to type in the connectionstring myself.

Trying several possibilities, the test connection button always cleamed the connection was OK, but when clicking OK i received the following message :

format of the initialization string does not conform to specification starting at index 0
After a long search, the solution was found, something is incorrect in the registry :
- Open the registry using regedit
- Find the  "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}"  in the tree
- Check if there is a subkey named ProgID there, if there is, you are not having the same problem as I had, but be sure to check the value

If the key is not there, add it :
- Right click the node and click new, key
- Name it ProgID
- Select the newly created key
- In the main (right) pane, doubleclick the "(Default)" value
- Set its value to "MSIDXS.1" (without the quotes ofcourse).

Now when you create a new connection to an access DB, you can use the correct window.

Wednesday, December 12, 2007

Microsoft has released Volta

About a week ago Microsoft released Volta from the labs.


What is Volta :


Volta is a developer toolset for building multi-tier web applications using existing and familiar tools, techniques and patterns, It allows to make the decisions until the very last passible moment.

It also enables new end-to-end profiling and testing.

It makes that you can build your application as a .NET client application and then assign parts of your application to the client side or the server side. The compiler automatically creates cross-browser JavaScript, web services and all required code for the tiers to communicate.


Volta has the following advantages :
In the architectural dimension :

Language-independence. Write Volta code in any language that compiles into MSIL. For example, C#, VB, IronPython, etc.
Leverage the entire .NET toolchain. Use libraries; the IDE, Intellisense, auto-complete, snippets; FxCop; profiler; class browser; ILDASM; and so on.
Low entry barrier. Reduce your learning burden; use “only the languages in the room.”
Brown-field applicability. Volta-enable existing applications for the cloud.
Beyond 2 tiers. Refactor to as many tiers as you need using exactly the same mechanisms recursively applied.

In the execution-platform dimension :
Deep embedding of CLR semantics. Preserve exact CLR semantics across platforms.
Cross-browser support. Use one programming model across browsers.
Complete orthogonality with refactoring. Mix and match refactoring and retargeting.
Ajax-ready. Write Ajax patterns and idioms in familiar .NET languages.
Debugging transparency. Debug code with a specific browser.
Leverage browser-specific features. Where needed, access features unique to each browser.
Visual-Studio integration. Enjoy seamless integration with the IDE.


In the next post we will make our first Volta application.
Can't wait?
Download volta here : http://labs.live.com/volta/download/