score:1
Accepted answer
it sounds like you want to use linq-to-sql. in that case you'll need to create a data context. there are plenty of tutorials on that.
you don't need to use linq to sql, however. your source can be any enumerable. a datareader, for example:
using (dbdatareader rdr = cmd.executereader()) {
from c in rdr.cast<dbdatarecord>()
select new xelement("event",
new xattribute("start", c["start"]),
new xattribute("end",c["eend"]),
new xattribute("title",c["title"]),
new xattribute("color",c["color"]),
new xattribute("link",c["link"])));
}
Source: stackoverflow.com
Related Query
- Converting SQL to LINQ to XML
- Converting SQL code with Row_Number() into LINQ C# code
- How are people unit testing code that uses Linq to SQL
- Add XML Comments to class properties generated by the LINQ to SQL designer
- LINQ Source Code Available
- Converting SQL containing top, count, group and order to LINQ (2 Entities)
- Converting an SQL query in to LINQ C#
- Converting sql statement that contains 'with' cte to linq
- C# XML documentation of Linq to SQL
- Is there any open source software for converting SQL statements to LINQ?
- How to code the partial extensions that Linq to SQL autogenerates?
- Determine the source DataContext for a Linq to Sql query
- How to get SQL query into LINQ form in C# code
- Converting SQL query into LINQ - not working
- ASP.Net MVC converting Sql to Linq
- Export SQL Server Database Table to XML Using Linq
- creating Linq to sqlite dbml from DbLinq source code
- Converting Linq expression to sql server query
- Does LINQ convert code to SQL queries
- How do i convert this linq code to inline sql
- Reuse Linq to SQL code with entityframework
- Identify source of linq to sql query
- Need help in converting SQL query to LINQ
- Converting SQL query to LINQ query
- Linq to sql as object data source - designer problem with partial classes
- Help converting an sql query into LINQ
- Converting LINQ to XML result to generic list in VB.NET. Odd error
- SQL subquery result in LINQ and Entity Framework Code First
- converting group SQL expression into LINQ
- How to flatten a multi level XML into a single level XML using c# code LINQ
More Query from same tag
- Entity Framework/Linq group related data
- How to properly (deep) map complex objects with C# LINQ?
- GUID parameter for entitydatasource in asp.net
- LINQ grouping multiple fields and placing non-unique fields into list
- Parse XML string with LINQ, create new object from xml
- Why one loop is performing better than other memory wise as well as performance wise?
- C# LINQ left join 3 Tables/Lists
- Is this LINQ Query "correct"?
- Retrieving entities as SelectListItems
- How should I share filtering logic between multiple LINQ-where clauses?
- In linq getting synonym of word
- Method cannot be translated into a store expression syntax error
- LINQ Statement with List<int?> not returning results?
- Difficult sort order with Linq to SQL
- Convert This Left-Join SQL to Method Syntax Linq
- LINQ multiple join hanging
- unable to access the linq to sql result in mvc4
- LINQ Max Date with group by
- linq to object get element from list
- NHibernate 3 and LINQ support?
- Complicated Linq expression builder
- Does Apache.Ignite.Linq support async/await?
- How to make a 'group by' on a Child's property and avoiding a 'NotSupportedException'
- Linq Excluding a column
- LINQ Grouping to same recipient
- Use RxJs operators on Array
- How to get minimum from multiple date columns in linq?
- How to return an IEnumerable of type X from a method
- Sql Query Convertion into Linq Query In Wcf Servive
- When running a method that uses linq to get the palindromes from a string, why does SelectMany order the resulting strings?