Entity data model

S

Seema

I put a page in a web applicationproject, added an ado.net entity model and
told it to generate the model from existing database, went back to my empty
page and put a GridView on it.I right clicked on the GridView and went to
show smart tag. I went to choose a datasource combo box and pressed downarrow
once (to create a new datasource). I chose entity and left the default name
EntityDataSource1 andthen pressed ok. I then got this error:

The entity model meta data specified in the connection string could not be
loaded. unable to load the specified meta data resourses
 
M

Mr. Arnold

Seema said:
I put a page in a web applicationproject, added an ado.net entity model and
told it to generate the model from existing database, went back to my
empty
page and put a GridView on it.I right clicked on the GridView and went to
show smart tag. I went to choose a datasource combo box and pressed
downarrow
once (to create a new datasource). I chose entity and left the default
name
EntityDataSource1 andthen pressed ok. I then got this error:

The entity model meta data specified in the connection string could not be
loaded. unable to load the specified meta data resourses

Well, did this Smart tag make the connection string? How do you know it's
actually pointing to the Model? The ADO.NET EF makes its own connection
string sitting in the app.config when you compiled the project that contains
the Model, if you told the EF Model creation wizard to make the connection
string during Model creation.

The connection string that the EF model creates must be copied to the
Web.config. And somehow this Smart Tag thing must point to the connection
string that the EF made I suspect.




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
M

Mr. Arnold

<snipped>

This is what I would do to load a datagrid from an Entity off of the EF
Model.

1) I would copy the connection string that the EF Model creation wizard
created to the Web.config. That connection string gives you the reference to
the Model and its mata data.

2) I would do this.

using(var dbconn = new EnityConnection())
{
datagrid.datasource = from a in dbconn.Entity select a; // loads all
the records
}

The Entity will be whatever table you're trying to load.

You'll need to use System.Linq, and you'll need System.Data.EntityClient.

If you're using VB.Net, it's still the same thing.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4068 (20090512) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top