Just converted a website using Dynamic Data to .NET 4.0. The basic scenario is that LinqDataSource is querying a Ticket, which has several associations (i.e. 'Contact') to other tables in the database. Now when the page loads and the DynamicField tries to bind to some of those associations I get the following error:
The table 'Tick...
I'm trying to write a LINQ query that that simply gets the count of rows where a variable ('id') is equal to the JOB_GROUP statement. Problem is, Visual Studio is returning an error on the ; at the end, saying 'Only assignment calls.....may be used as a statement'. Is there anything obvious wrong with my query?
var noofrows = from s in ...
I just made a Linq-to-SQL .dbml file in Visual Studio 2010.
I'm getting the following 2 errors, a total of 60 times in total, mostly the first.
The type or namespace name 'Linq'
does not exist in the namespace 'System.Data'
The type or namespace
name 'EntitySet' could not be found
I've found various similar questions here and on oth...
I have a lot of pre-linq C# 1.0 code which converts the output from a stored procedure (SQL 2005) into a collection of objects. It goes as follows:
Declare a class with properties matching the columns in the output.
using SqlDataReader, loop while there are rows to read
For every row, add an object to a List
return that list
Although...
I have a stored procedure that builds a dynamic where clause and executes the SQL statement. It looks similar to this:
declare @customerId int
declare @sql varchar(100)
set @customerId = 12
set @sql = Replace('select customerName from customer where customerId = @customerId', '@customerId', @customerId)
exec @sql
I know the above do...
Hi,
I'm very new to using Linq-to-SQL, that's why I'm asking this question. I've searched the site, but can't seem to figure out how to do this.
My problem is:
I have a database mapped with LINQ to SQL:
Table 1: PersonalTasks
TaskId
Header
[Content]
IsDone
CreatedDate
Table 2: Comments
CommentId
TaskId
UserId
Comment
CreatedDate
...
I have some code that inserts data into some tables (one table has a FILESTREAM column) and then calls SubmitChanges after it is done.
db.Log = new System.IO.StreamWriter(@"c:\windows\temp\linq.log") { AutoFlush = true };
db.SubmitChanges(ConflictMode.FailOnFirstConflict);
I have referenced the following links but they appear to not b...
I have used AsyncFileUpload AJAX control to upload a file to a column in a SQL Server database using LINQ to SQL. How do I retrieve the document from the database and allow the user to save to local drive using a Save As Dialog box using LINQ to SQL? This is ASP.NET web application. The DocumentFileContent database column is a Image S...
I have this contact list which I'm building using LINQ to SQL. The query to get a list of contacts is:
return db.Contacts.ToList();
In the list I also want to display each contact's primary e-mail address. To do this I first rewrite my query:
return (from db.Contacts
select c).ToList();
I found this nice way to do left join...
I have a database with the following tables:
create table Categories (
Id int primary key,
Name nvarchar(256) not null)
create table Products (
Id int primary key,
Name nvarchar(256) not null,
CategoryId int not null,
foreign key (CategoryId) references Categories (Id))
Using DataLoadOptions, I can write this:
DataLoadOp...
I'm currently building a .net web application that uses WCF web services to allow a Flex front end to access the database.
I'm in the process of setting up some unit/integration style testing on the web services and am trying to work out the best way to allow the tests to access and modify data in a separate test database.
Currently, t...
For anyone interested in learning LINQ To SQL, could you suggest:
good book titles
web articles/tutorials
videos
UPDATE: After googling i found most usefull the following
LinqPad (I already bought a licence!)
Linq in Action by Manning and
Linq videos from the VB Team
Please be my guest and complete the list!
...
I have class Zones with properties and i want add data which i read with linq to this properties.
example
List<Zones> z = new List<Zones>
z.add(new Zones(...));
var allZones = from s in db.Zones select s;
How can i add allZones to z generic List?
...
I would like to create a linq to sql class library that I can reference in all of my custom modules for this project I am working on. Does anyone have any suggestion or examples that I may reference?
I have about 3-4 custom modules requirements that all will pull data from the same set of tables. I could implement this using the standa...
I'm looking at this Telerik demo, and am unable to get the "count" statement to work. I believe that the following command is only supported on EntityFramework, and not Linq2SQL.
return CurrentDataSource.Products.Where(where).Count();
The parameter "where" in lowercase is actually a string that is passed in the ADO.Net DataServices ...
This is a baffling one. My ASP.NET 3.5 app that was working fine suddenly started getting timeout errors...
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
...but only for requests with the correct username/password in the connection s...
I am creating an xml file with LINQ as follows...
Public Sub CreateXml()
Dim db As New MDataContext
Dim Customers = <gallery columns="3" rows="3">
<%= From customer In db.Customers _
Select <customer>
<name><%= custo...
I've generated LINQ to SQL classes from a database not under my control which has a lot of Decimal(38, 5) fields. Apparently the range of the .NET Decimal type is smaller than this, so the LINQ to SQL code generator is throwing a lot of warnings:
DBML1008: Mapping between DbType 'Decimal(38,5)' and Type 'System.Decimal' in Column 'St...
Hi,
Quick question on how to get even more out of PredicateBuilder. It works as per below:
IQueryable<Product> SearchProducts (params string[] keywords)
{
var predicate = PredicateBuilder.False<Product>();
foreach (string keyword in keywords)
{
string temp = keyword;
predicate = predicate.Or (p => p.Description.Contains...
I want to declare a variable to hold the query result from LINQ to SQL like to the following:
Dim query As IQueryable(Of Student)
If isNoUserName Then
query = From st In db.Students _
Order By st.AssignedId Ascending _
Where (st.studentId = studentId _
Select st
Else...