Follow us

Latest Posts

Friday, September 18, 2015

Mad Guy Films - Thoughts portrayed by a Techie .........

Hi Friends,

We need your kind support for 'Mad Guy Films' which is running by my friend and a techie Hemant Sharma.

Please watch out the short films and trailers at MDF YOUTUBE channel.



Don't forget to subscribe the channel and post your reviews.

# We are engineers, we can do anything !!!
read more...

Sunday, June 30, 2013

Good News : .NET interview questions 6th edition (Sixth edition) Released

Good news for Techies!!! 

6th Edition of .Net interview Questions : By Shivprasad Koirala has been released. I have gone through earlier edition of this book during my job searching period. 



Good thing about this book is: Topics are well organised and categorized as per the experience level of the user.



read more...

Thursday, December 8, 2011

How to: Turn Pluralization On and Off (O/R Designer)

Introduction

How to: Turn Pluralization On and Off (O/R Designer)

By default, when you drag database objects that have names ending in 's' or 'ies' from Server Explorer / Database Explorer onto the Object Relational Designer (O/R Designer) , the names of the generated entity classes are changed from plural to singular.

Reason

This is done to more accurately represent the fact that the instantiated entity class maps to a single record of data. For example, adding a Members table to the O/R Designer results in an entity class named Member because the class will hold data for only a single Member.

Pluralization is on by default only in the English-language version of Visual Studio.

To turn pluralization ON and OFF

  1. On the Tools menu, click Options .
  2. In the Optionsdialog box, expand Database Tools.
  3. Click O/R Designer.
  4. Set Pluralization of names to Enabled = False to set the O/R Designer so that it does not change class names.
  5. Set Pluralization of names to Enabled = True to apply pluralization rules to the class names of objects added to the O/R Designer.

Source : MSDN

read more...

Wednesday, December 7, 2011

LINQ to SQL #3 : Querying database using LINQ to SQL

First of all, we need to add a .dbml file as explained in previous post.

Technoscatter.dbml

Query #1: Get all members and their details.

Get all members and their details.

Query #2: Get First Name, Gender and Email Address of all members.

Get First Name, Gender and Email Address of all members.

Query #3a: SORTING : Get Member's Details on basis of First Name in Ascending Order.

Get Member's Details on basis of First Name in Ascending Order

Query #3b: SORTING : Get Member's Details on basis of First Name in Descending Order.

Get Member's Details on basis of First Name in Descending Order

Query #4: TOP : Get TOP 5 records of Members.

Get TOP 5 records of Members

Query #5: SKIP : Skip TOP 1300 records and get remaining records.

Skip TOP 1300 records and get remaining records

Query #6: DISTINCT : Get Distinct Member Names.

DISTINCT : Get Distinct Member Names

Query #7a: FILTERING : Get Members whose Name starts with 'A'.

FILTERING : Get Members whose Name starts with 'A'

Query #7b: FILTERING : Get Members whose Name ends with 'Y'.

FILTERING : Get Members whose Name ends with 'Y'

Query #7c: FILTERING : Get Members whose Name contains 'an'.

FILTERING : Get Members whose Name contains 'an'

Query #8: Get members who are 'Accountant'.

Get members who are 'Accountant'.

Query #9: Get members whose First Name is 'Aaron'.

Get members whose First Name is 'Aaron'.

Query #10: Get members whose DOB is on or after 31st December 2010.

Get members whose DOB is on or after 31st December 2010.

read more...

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?)

Scenerio

I was trying the following LINQ to SQL code.

LINQ to SQL : Error

Error

Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.IEnumerable<Member>'. An explicit conversion exists (are you missing a cast?)

Solution

I have explicitly created a class MemberBasicInfo containing FirstName, Gender and Email as properties and modified the LINQ to SQL query as shown below & it was working fine.

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?)

Hope! this will be helpful to LINQ to SQL learners.

read more...