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
- Can I use LINQ to skip a collection and just return 100 records?
- .NET String parsing performance improvement - Possible Code Smell
- LINQ to Entities does not recognize the method 'System.String ToString(Int32)'
- Using LINQ in Wolfram
- LINQ (to objects) , running several queries over the same IEnumerable?
- SELECT COUNT in LINQ to SQL C#
- Null checker in LINQ
- Linq lambda expression to get at least one duplicate along with non duplicates
- How to automatically fill xml ? linq to xml
- Where condition using Linq
- Why casting result of Select to List returns null
- How to do sorting on the basis of attributes in c#
- Chain query in Linq
- Ordering a list based on multiple factors
- Any.Equals to case insensitive
- LINQ aggregating multiple IEnumerables into one?
- How does the .All(db1 => db1.Text != wb.Text)) in LINQ work when comparing two lists?
- Converting a Linq statement in VB to C#
- Issue getting VS2010 to recognize System.Data.DataSetExtensions
- How to use if condition on enumerable inside where clause
- Select Value from Dictionary if Key exists using LINQ
- Delete duplicate records with joined table and fix foreign keys on related table
- object Collection Containing a List of IDs Linq
- Find Most Frequent Words using LINQ
- linq-to-sql "Cannot remove an entity that has not been attached"
- Find intersecting DataRows in a List of DataTables
- C# flatten a list of objects with a list property
- Merge 2 lists of 2 different types (alternatives)
- Hitting the 2100 parameter limit (SQL Server) when using Contains()
- Map list to custom Dictionary