Searching
Searching

Reputation: 2279

Silverlight, connecting to multiple databases on different servers

I'm developing a Silverlight 4 application (C#).

I used Silverlight Web application template and Entity framework to get started + VS 2010.

I now have a running application that connects to the database and displays data properly.

The database has one table with 5 attributes.

So what i need to do now..

  1. I have a connection string to connect to a database on an external server. The database is similar to mine, but with more tables and updated information.I need to connect to this database. (EDIT: since this is outside my project i wont be having any EF for this but just privilege to query a single table. (VIEW to be specific))

  2. Since I know the attribute names, table etc., use a SELECT query and get the data. So execute and get the result set. (E.g. "SELECT R.name, R.marks FROM results R").

  3. The result set from query will be stored in, for example a data-table, and then insert into my database.

  4. I also created an object class with accessors for the table, so that I can give the 'result set' the structure before I insert.

Theoretically this sounds possible when I chalk it on my board but I want to know if this would work?

I mean having 2 database connection open. Is this possible? If I follow the same steps as above can I achieve what I want?

Please let me know if I'm unclear about anything. This is just a smaller version of the real application but the logic i need to implement is the same. :)

If there is a better approach I'm happy to consider.

Cheers

Upvotes: 3

Views: 243

Answers (1)

VagabondSW
VagabondSW

Reputation: 53

You may be over thinking this a little. I add a new class project, and add a new ADO.NET Entity Model to that project using the connection string for the second database. After that, you'll be able to reference the new EF project from your Service or Host (Web) project.

Upvotes: 2

Related Questions