0

I have a scaffolded C# site showing a table in one database, but I would like to expose an associated field from a table in another database.

There is a stored procedure in the current database that retrieves items from the secondary table, but how do I encapsulate this data and use it?

I have added the stored procedure to the current model, but I don't see a way of making use of it.

I have looked into Complex Types, thinking that this may be the route to take, but I can't seem to find the documentation I'm looking for.

vwfreak
  • 369
  • 2
  • 5
  • 18

1 Answers1

0

You need to make sure that you can access both databases from the datacontext that your controller is using (I'm guessing that you're using MVC). If you cannot access the second database from your current context. Make sure to access a context that can, or add that database to a new connection string and access it separately.

Check in the specific controller to make sure it's giving access to that field in the correct database and table. Once that's done, you will need to recompile (build) and update the view by accessing it through the model syntax:
@model.yourNewField

BRogers
  • 3,534
  • 4
  • 23
  • 32