0

I have ADO.NET FILE that mapped all the database tables in Microsoft SQL server database, I'm wondering if there's any way I can link between tables at run time? For example all the tables will be displayed, the user select the required tables and columns then run the query, so I will get the tables and columns names as text, so how can I run a query based on that? the problem is with the primary key and foreign key, all the tables linked together using navigation property in ado.net I can easily link between more than one table using navigation property but I can't do that at run time.

  • Depends on what query you want you can generate linq query expressions and invoke expression to DbContext with reflection like this:http://stackoverflow.com/a/9525578/440030 – Reza ArabQaeni Jun 26 '16 at 11:28
  • You can get tables by using GetSchema. See following webpage : https://msdn.microsoft.com/en-us/library/ms254934(v=vs.110).aspx – jdweng Jun 26 '16 at 12:22
  • Thanks for that but I'm struggling to link between tables at run time – Moustafa Mansour Jun 26 '16 at 12:40

0 Answers0