Hi,
I have an existing web app that has a data layer and a bll that calls the data layer. The data layer is ado.net that calls stored procedures.
I created another project in vs.net for linq-to-sql, dragged all my tables over.
Would it be wise to just start using linq or should I spend the time and re-write all the db logic in linq ju...
Hi
how can you do multiple "group by's" in linq to sql?
Can you please show me in both linq query syntax and linq method syntax.
Thanks
Edit.
I am talking about multiple parameters say grouping by "sex" and "age".
Also I forgot to mention how would I say add up all the ages before I group them.
If i had this example how would I d...
Hi
How do I select multiple columns in linq to sql method syntax? I only know how to select one column but not multiple columns.
Like if I had a this table
ProductId
ProductName
ProductQty
ProductNumber
How could I select productName and ProductQty but not ProductNumber or ProductId in linq to sql method syntax?
...
Working with Linq2Sql as a driver for a Wcf Service. Lets go bottom up....
Down at the bottom, we have the method that hits Linq2Sql...
public virtual void UpdateCmsDealer(CmsDealer currentCmsDealer)
{
this.Context.CmsDealers.Attach(currentCmsDealer,
this.ChangeSet.GetOriginal(currentCmsDealer));
}
That gets used b...
public class TestBL
{
public static void AddFolder(string folderName)
{
using (var ts = new TransactionScope())
{
using (var dc = new TestDataContext())
{
var folder = new Folder { FolderName = folderName };
dc.Folders.InsertOnSubmit(folder);
...
Ive been searching for Linq tutorials online and came across some articles saying that linq may go away? What is your take on this? Will microsoft really do away with linq
...
Would creating another datacontext in the GetData3() method lead to problems?
public void SetoFDataMethods()
{
using (DataContext DC= new DataContext())
{
var d1=DC.GetData1();
var d2=DC.GetData2();
var d3=DC.GetData3();
display(d3);
}
}
public result GetData3()
{
If (c...
I have a site where I have a database of persons and each person can have multiple intrests which is handled through a one to many relationship between a persons table and an interests table. On the site I want to have a serach where you can have a multiple select box of interests and the user can pick as many as they want. What I want t...
I used SQLMetal to generate a code file representing my database, and i can't figure out how to add entries to the database from the SQLMetal generated classes. How do i do this? do i just add to the various properties or something?
...
Hi,
Appreciate if I can get some help writing a LINQ that will get ALL FIELDS from table A, and those fields for which profile 1 has a value in table AB, show the value, otherwise if profile 1 has no entry in table AB, then show value as null.
Table A
AID Field
-----------
1 OneField
2 TwoField
3 ThreeField
Table ...
I'm working on a web service project, and I'm coding at home, where I have SQL Express 2008 installed, but the app needs to interface with an SQL Server Standard. I've never done the transition before, and I haven't been able to find any resources on the subject - plenty of stuff about upgrading, but nothing about how to deploy.
For ins...
My MVC app is returning SqlExceptions when trying to access any table in my database.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Projects'.
My app us linq for the data layer.
If I use an old dll it works fine, (so doesn't seem to be a problem with the DB) just this latest app dll that I've uploaded...
This question is similar to this question but not quite the same.
Can I make a dynamic query on a linq-to-sql data context and have the result return as an IDictionary<string, object> where the key is the name of the column?
A bit like so (doesn't compile, but illustrates the intention)
IDictionary<string, object> data = new Dictionar...
I asked a question here about an Linq error that results from mixing Linq-To-SQL with C# code. In brief, the compiler gets confused and doesn't realize that you are intending to call a local function on the resultset after it's come back from the database.
The answer I accepted was to use AsEnumerable() on the result set, thus forcing ...
Where I work it is a requirement for us to go through stored procedures as a mechanism to access our data through code. I am using LINQ2SQL to minimize this pain so that I can work with objects instead of ADO.NET directly. I have a situation Linq2SQL is consuming one of my stored procedures an generating code where the return type from...
I'm using LINQ-to-SQL for CRUD functionality, and DataContractJsonSerializer to serialize the object to JSON. I am also using ASP.NET MVC's data binding to post values to an MVC action that does the inserting. The problem is that it will serialize all of the properties except the Id property. I've got the model set up as so:
[Serializab...
I’ve two issues that I was hoping for some insight on and/or some appropriate links or Google terms to use to find more information on as I’m not finding anything. It boils down to the fact that I would like to find out when/how an IQueryable expression that is going to be executed determines that some of the expression result needs to ...
I need to grab all categories that don't have subcategories
1
^--1.1
^--1.2
^--1.2.3
2
^--2.1
3
In this example I would want to get [1.1], [1.2.3], [2.1] and [3].
My Categories table looks like this:
CategoryID | CategoryName | ParentID
I figure I should be selecting all the categories where it's CategoryID isn't used in an...
Hi, I'm using LINQ to SQL to get a search result of a FullTextSearch stored procedure in Sql server 2008. I dragged the procedure from the server explorer to the designer, and got the method created with the appropriate return type and parameters. Now the problem is, I need to get the Count of the result of calling this method, so using ...
I have a pair of Linq to SQL queries which contain the same complex Where clause, specifically:
where ((range.MinimumFrequency <= minFreq && minFreq <= range.MaximumFrequency)
|| (range.MinimumFrequency <= maxFreq && maxFreq <= range.MaximumFrequency)
|| (range.MinimumFrequency <= minFreq && maxFreq <= range.MaximumFrequency)
|| (range...