Get Table information using foreign keyAdd a column with a default value to an existing table in SQL ServerHow to check if a column exists in a SQL Server table?How can foreign key constraints be temporarily disabled using T-SQL?What's the best practice for primary keys in tables?Table Naming Dilemma: Singular vs. Plural NamesHow can I list all foreign keys referencing a given table in SQL Server?Insert results of a stored procedure into a temporary tableHow to use LINQ to select object with minimum or maximum property valueEntity Framework Code First - two Foreign Keys from same tableGet size of all tables in database
Is it a acceptable way to write a loss function in this form?
How precise must a satellite's orbit be?
Use 1 9 6 2 in this order to make 75
How to create a cubic equation that include sums of the roots of another cubic equation
How durable are silver inlays on a blade?
Should I refuse to be named as co-author of a low quality paper?
Is it possible to have 2 different but equal size real number sets that have the same mean and standard deviation?
Can you make an identity from this product?
How can one's career as a reviewer be ended?
How do free-speech protections in the United States apply in public to corporate misrepresentations?
How to write a convincing religious myth?
Why Does Mama Coco Look Old After Going to the Other World?
Why do radiation hardened IC packages often have long leads?
Why did Intel abandon unified CPU cache?
noalign caused by multirow and colors
Rail-to-rail op-amp only reaches 90% of VCC, works sometimes, not everytime
C++ logging library
Accessing /systemTopic/ streaming channel
A Salute to Poetry
If there's something that implicates the president why is there then a national security issue? (John Dowd)
How to befriend someone who doesn't like to talk?
Is Dumbledore a human lie detector?
Who is "He that flies" in Lord of the Rings?
Can a human be transformed into a Mind Flayer?
Get Table information using foreign key
Add a column with a default value to an existing table in SQL ServerHow to check if a column exists in a SQL Server table?How can foreign key constraints be temporarily disabled using T-SQL?What's the best practice for primary keys in tables?Table Naming Dilemma: Singular vs. Plural NamesHow can I list all foreign keys referencing a given table in SQL Server?Insert results of a stored procedure into a temporary tableHow to use LINQ to select object with minimum or maximum property valueEntity Framework Code First - two Foreign Keys from same tableGet size of all tables in database
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I want to get all rows in a table where the foreign key is a set value.
So I have the line underneath to get all the values in the table Resultater
var resultater = _context.Resultater.ToArray();
I want to limit the results to only those that match the foreign key. I would imagine it to be something like:
var foreignKey = 1;
var resultater = _context.Resultater.Where(ForeignKey == foreignKey).ToArray();
The model/table looks like this
public int Id get; set;
[Required]
public string ForeignKey get; set;
[Required]
[Display(Name = "Dato")]
public DateTime Date get; set;
public string Form get; set;
c# asp.net
add a comment |
I want to get all rows in a table where the foreign key is a set value.
So I have the line underneath to get all the values in the table Resultater
var resultater = _context.Resultater.ToArray();
I want to limit the results to only those that match the foreign key. I would imagine it to be something like:
var foreignKey = 1;
var resultater = _context.Resultater.Where(ForeignKey == foreignKey).ToArray();
The model/table looks like this
public int Id get; set;
[Required]
public string ForeignKey get; set;
[Required]
[Display(Name = "Dato")]
public DateTime Date get; set;
public string Form get; set;
c# asp.net
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
In the tableResultaterI have the columnForeignKeyand I want all rows that match theforeignKey. The problem is that I don't know how to limit the result from_context.Resultater.ToArray();
– Sondre
Mar 24 at 21:52
add a comment |
I want to get all rows in a table where the foreign key is a set value.
So I have the line underneath to get all the values in the table Resultater
var resultater = _context.Resultater.ToArray();
I want to limit the results to only those that match the foreign key. I would imagine it to be something like:
var foreignKey = 1;
var resultater = _context.Resultater.Where(ForeignKey == foreignKey).ToArray();
The model/table looks like this
public int Id get; set;
[Required]
public string ForeignKey get; set;
[Required]
[Display(Name = "Dato")]
public DateTime Date get; set;
public string Form get; set;
c# asp.net
I want to get all rows in a table where the foreign key is a set value.
So I have the line underneath to get all the values in the table Resultater
var resultater = _context.Resultater.ToArray();
I want to limit the results to only those that match the foreign key. I would imagine it to be something like:
var foreignKey = 1;
var resultater = _context.Resultater.Where(ForeignKey == foreignKey).ToArray();
The model/table looks like this
public int Id get; set;
[Required]
public string ForeignKey get; set;
[Required]
[Display(Name = "Dato")]
public DateTime Date get; set;
public string Form get; set;
c# asp.net
c# asp.net
asked Mar 24 at 21:39
SondreSondre
356
356
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
In the tableResultaterI have the columnForeignKeyand I want all rows that match theforeignKey. The problem is that I don't know how to limit the result from_context.Resultater.ToArray();
– Sondre
Mar 24 at 21:52
add a comment |
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
In the tableResultaterI have the columnForeignKeyand I want all rows that match theforeignKey. The problem is that I don't know how to limit the result from_context.Resultater.ToArray();
– Sondre
Mar 24 at 21:52
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
In the table
Resultater I have the column ForeignKey and I want all rows that match the foreignKey. The problem is that I don't know how to limit the result from _context.Resultater.ToArray();– Sondre
Mar 24 at 21:52
In the table
Resultater I have the column ForeignKey and I want all rows that match the foreignKey. The problem is that I don't know how to limit the result from _context.Resultater.ToArray();– Sondre
Mar 24 at 21:52
add a comment |
1 Answer
1
active
oldest
votes
you should change the lambda query like this
var foreignKey = 1;
var resultater = _context.Resultater.Where(x=> x.ForeignKey == foreignKey).ToArray();
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328831%2fget-table-information-using-foreign-key%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
you should change the lambda query like this
var foreignKey = 1;
var resultater = _context.Resultater.Where(x=> x.ForeignKey == foreignKey).ToArray();
add a comment |
you should change the lambda query like this
var foreignKey = 1;
var resultater = _context.Resultater.Where(x=> x.ForeignKey == foreignKey).ToArray();
add a comment |
you should change the lambda query like this
var foreignKey = 1;
var resultater = _context.Resultater.Where(x=> x.ForeignKey == foreignKey).ToArray();
you should change the lambda query like this
var foreignKey = 1;
var resultater = _context.Resultater.Where(x=> x.ForeignKey == foreignKey).ToArray();
edited Mar 24 at 21:55
Hadi
26.6k73175
26.6k73175
answered Mar 24 at 21:48
Razmik GhookasRazmik Ghookas
854
854
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328831%2fget-table-information-using-foreign-key%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So what is the question and what issue you are facing?
– ssilas777
Mar 24 at 21:43
In the table
ResultaterI have the columnForeignKeyand I want all rows that match theforeignKey. The problem is that I don't know how to limit the result from_context.Resultater.ToArray();– Sondre
Mar 24 at 21:52