I have a linqtosql dbml where I dropped a stored procedure into the designer interface.
Stored procedure name:
GetUser(@userid int)
Select * from users_tbl where userid=@userid
Now in the code I want to do something like this:
Dim db as new UserDataContext
Dim myuser as users_tbl = db.GetUser(1)
How can I tell if GetUser returned...
intHi,
Pretty new to LINQ.
I have a Ratings table.
A User adds a set of Ratings for an Entity
There can be more than one Rating set for an Entity per User.
For example, let's say the Entity is a car. The car is rated on Appearance and Performance. And a User can rate the given car's appearance and performance more than once. So my ...
Hi all.
Can anybody help me with this: I want select all records from datatable which have for example sid=123 and after that save they with sid=456.
How can I do this with LINQ?
...
Hi,
I have three tables Student, TimeSheet and TimeRecord.
Talbe columns:
Student : StudentId, FirstName,
LastName
TimeSheet: TimeSheetId,StudentId, IsActive
TimeRecord: TimeRecordId,TimeSheetId, BonusHour(type int), CreationDate
Table relationship:
Student 1:N TimeSheet (FK StudentId)
TimeSheet 1:N TimeRecord (FK TimeSheetId)
...
Say you have the following entities defined in a LINQ class:
Product
Customer
Category
Should I have one repository class for all:
StoreRepository
... or should I have:
ProductRepository
CustomerRepository
CategoryRepository
What are the pro & cons of each? In my case, I have several "applications" within my solution... the Stor...
I have the following example:
using (MyContext context = new MyContext())
{
var query = from entityA in context.EntityA.Include("TestProperty")
join entityB in context.EntityB on entityA.Id equals entityB.EntityAId
join entityC in context.EntityC on entityB.Id equals entityC.EntityBId
...
I have three tables Student, TimeSheet and TimeRecord.
Talbe columns:
Student : StudentId, AssignedId, FirstName,
LastName
TimeSheet: TimeSheetId,StudentId, IsArchive, IsComplete
TimeRecord: TimeRecordId,TimeSheetId, BonusHour(type int), CreationDate
Table relationship:
Student 1:N TimeSheet (FK StudentId)
TimeSheet 1:N TimeRecord...
Hi,
I have the following query, I'd like to sum the NULL value also. Some TimeSheet don't records in TimeRecord and some tr.TimeIn and tr.TimeOut are NULL.
The query select only TimeSheet that has reords in TimeRecord. How I can have it select everything, and sum up the NULL value as well. So, the SUM of NULL will be just zero.
Table ...
I have 2 linq 2 SQL statements I'd like to be in a transaction (the SQL server is remote, outside firewalls etc) all other communication works but when I wrap these 2 statements in a TransactionScope() I begin having to configure MSDTC which we did, but then there are firewall issues (I think) is there a simpler way?
the basics of what ...
Suggestion either in C# or VB.NET are welcome.
Table relationship:
Student 1:N TimeSheet (FK StudentId)
TimeSheet 1:N TimeRecord (FK TimeSheetId)
Dim query = From s In db.Students _
Let pair = (From ts In db.TimeSheets _
Join tr In db.TimeRecords On tr.TimeSheetId Equals ts.TimeSheetId _
Where ...
I have a basic search control which lists companies from a CRM depending on predefined search/filtering criteria supplied by dropdowns. The default selection is "ALL" for each DropDown, otherwise the user chooses a specific item(s). I'd like to be able to construct a Linq query dynamically based on the selections. Out of the 5 selectors ...
I have the following class that can create/delete and list entities:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace Backend.Models
{
public class PaisRepository
{
private EnviosDataContext db = new EnviosDataContext();
public IQueryable<Pai> Fin...
my table column is:
AttachContent varbinary (max)
when i try to retrieve the data and i get this below error, i am using linq
cannot convert from 'System.Data.Linq.Binary' to 'System.IO.BinaryReader'
...
How can I produce something like this with Linq? I'm trying to work something out, this is related to my other post, but my distinct keeps coming back with more rows than expected
http://stackoverflow.com/questions/3533629/add-conditional-join-dynamically-with-linq
select distinct c.CompanyID, c.CompanyName from Company c
left join Com...
Was I was previously messing with Silverlight and RIA, I was using a an ADO.NET Entity Data Model and domain context. I'm teaching myself how to run a stored procedure from RIA, and could not get it to work with the previous setup so I then started to try out using the LINQ to SQL method. I did the following:
Added the DBML
Drag and d...
I'm trying to build a search that is similar to that on Google (with regards to exact match encapsulated in double quotes).
Let's use the following phrase for an example
"phrase search" single terms [different phrase]
Currently if I use the following code
Dim searchTermsArray As String() = searchTerms.Split(New String() {...
all the table names are appended with a 's'??
like table test
will appear as tests in the coding..
please help
is this a known bug, or ?
...
I would like to select from a table using linq to sql without knowing what that table is until runtime, something like
Type t = Type.GetType(myString);
var results = from o in context.t select o;
Obviously this doesn't work, but I was wondering if there was a way to do this.
...
This one should be easy.
I have a Reviews table with records.
The columns are EntityID, UserID, Body, DateModified.
A User can submit multple entries for an Entity.
I want to select all the Reviews that are the most recent entries for a given entity per UserID.
So the table might look like this:
EntityID UserID Body DateMo...
I'd like to get suggestion in both C# and VB.NET
I have two tables Employees and CafeLogs. Some employees can be cashiers and also customers at the Cafe shop.
Table structures:
Employees: EmployeeId(PK) , FirstName, LastName
CafeLogs: LogId (PK), CashierId, EmployeeId, Value, => CashierId and EmployeeId are the data from column Emp...