Skip to main content

Entity Framework 4 and SQL Server 2000

it can be done!!..


(Microsoft .NET,Microsoft SQL Server,Database) by Jason Skowronek on 11/07/2011
If you are unfortunate enough to have to support applications running on legacy SQL Server 2000 databases like me, you are probably aware of the limitation of Visual Studio 2010 and Entity Framework 4.0 for SQL Server 2000.
There are plenty of articles out there on work-arounds. I find this one the most direct and feasible. Granted, I have not looked into possible version issue that may result in doing it this way, but for the various applications on which I have worked, it is sufficiently elegant and functional.
This a work-around. Let me repeat, this is a work-around!.
Here are the steps to add a new Entity Framework 4 entity context to a Visual Studio 2010 project:
  1. Download the base entity data model for SQL Server 2000 file and save it to the project folder to which you wish to add the SQL 2000 entity context. Do NOT add it to your project yet.
  2. Rename the EDMX file to the name of the data context (e.g. MyDataModel.edmx).
  3. Open the EDMX file in a text editor.
  4. Find/replace all references to %DB_NAME% with your own value (e.g. SomeDatabaseName).
  5. Add this new connection string section to your App or Web.config and find/replace with your own values:
    1
    2
    3
    <connectionStrings>
      <add name="%DB_NAME%Entities" connectionString="metadata=res://*/%DB_NAME%.csdl|res://*/%DB_NAME%.ssdl|res://*/%DB_NAME%.msl;provider=System.Data.SqlClient;provider connection string="Data Source=%DB_HOST_NAME%;Initial Catalog=%DB_NAME%;Persist Security Info=True;User ID=%DB_USER%;Password=%DB_USER_PWD%;MultipleActiveResultSets=False"" providerName="System.Data.EntityClient" />
    connectionStrings>
    Please note: the connection string name MUST MATCH the EntityContainer section name you specified in the EDMX file.
  6. After the .edmx and web.config files configured, add them to the project and verify the new entity data source appears after refreshing the Data Source manager window.
  7. If the new entity data source appears, open the .edmx file in design view and refresh the design model.

for a detail workaround at this link

credit goes to the author

until then

Comments

Popular posts from this blog

SBO - Internal Error (-5002) Occured in Inventory Transfer

this is something that not well documented in SBO, it took me several hours to look at Google and can't find anything about it. Thank God friend of mine got answer for this one.So the Sympton is something like this, u need to make Inventory Transfer for Batch Item and Serial Item in one single Transaction so the Transaction is the combination of it. ex in detail lines: 1. Serial Item 2. Batch Item 3. Batch Item 4. Batch Item 5. Serial Item 6. Serial Item . When u reach this code oStockTransfer.Add it will return an error "Internal Error (-5002) Occured". This is because ur details is not in order, meaning u need to order the line with combination of Batch first then Serial or Serial first then Batch so be careful with this thing :D see u

Crystal Report 2010 - Failed to load database information

"Failed to load database information" error when i try deploy my program with CR 2010 using TTX file as report definition this is because there is missing .dll, call "CRDB_FIELDDEF.DLL"..u need to manually copy the file to "C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86" folder then the report is loading again it said that TTX is old tech but i'm still using it because i don't need to connect the report to any DB, but until i found new one to replace :D check this link to read it [EDIT 25 Jan 2011] i think i'll using ADO.NET Dataset next time :D until then

Resolve Collation error in SQL Server

i often get this error when trying to JOIN some table Cannot resolve the collation conflict between "SQL_Latin1_General_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. u need to use COLLATION when performing the JOIN, something like this SELECT field1 FROM table1 INNER JOIN table2 ON table1.field3 COLLATE DATABASE_DEFAULT = table2.field4 COLLATE DATABASE_DEFAULT i found this when trying to JOIN, maybe it affect other areas..until i found one see u