Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 casting in Linq

Author  Topic 

aoriju
Posting Yak Master

156 Posts

Posted - 2009-01-06 : 06:27:33
I am a new user in linq.
Can u please tell me how to cast the iqueryable(decimal?) into decimal

Thanks

raky
Aged Yak Warrior

767 Posts

Posted - 2009-01-06 : 06:29:44

why you want to change a decimal datatype column into again decimal.Iam giving basic syntax to convert a column of someotherdatatype into decimal..Note we can't convert columns of all datatypes( Only with some are possible) to decimal datatype

Select cast( columnname as decimal(18,2)) from yourtable
Go to Top of Page

aoriju
Posting Yak Master

156 Posts

Posted - 2009-01-06 : 06:36:32
Thanks for the reply
the casting you send is of sql query
its not the exact i want.

My Linq query is written below

var value=
from tbl in contract.EVS_SRV_Contract_Details
where tbl.Contract_Id == contractId
&& tbl.Service_Id == serviceId
select tbl.Transaction_Rate;

the type of value is iqueryable(decimal?)
but i want as decimal.

Thanks
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2009-01-06 : 06:46:18
is there not perhaps a linq forum you could post your question in rather than a sql server one?

Em
Go to Top of Page

aoriju
Posting Yak Master

156 Posts

Posted - 2009-01-06 : 07:03:54
Sorry Boss.

If anyBody knows the answer then tel me.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-06 : 10:32:51
Microsoft forum is good for LINQ:
http://forums.microsoft.com/MSDN/ShowForum.aspx?siteid=1&ForumID=123
Go to Top of Page

aoriju
Posting Yak Master

156 Posts

Posted - 2009-01-07 : 05:20:22
Thanks.

Its very useful
Go to Top of Page
   

- Advertisement -