我没有在MVC 3中创建或使用现有数据库 [英] i am not getting creating or using existing database in MVC 3

查看:53
本文介绍了我没有在MVC 3中创建或使用现有数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我没有使用剃刀在MVC 3中获取数据库连接
我创建了一个将模型连接到数据库的小应用程序.
我已经设置了服务器的连接字符串,效果很好
但是当我将连接字符串更改为本地服务器时,它显示以下错误.

提供程序未返回ProviderManifestToken字符串


在这里,我有连接字符串,第一个是在服务器上创建数据库的服务器.

hi to all.

i m not getting the database connetion in mvc 3 using razor
i have created one small application that connects the model to database.
i have set up the connection string of server this works well
but as i changes the connection string to my local server it shows following error.

The provider did not return a ProviderManifestToken string


here i have connection strings first one is of server that creates database on server.

< add name="MoviesContext" connectionstring="Data Source=SERVER\SQL2008;Initial Catalog=Movies;User Id=sa;Password=Admin@101;" providerName="System.Data.SqlClient" >;


< add name="MoviesContext" connectionstring="Data Source=KAUSHAL-PC\SQL2008;Initial Catalog=Movies;">
        providerName="System.Data.SqlClient" >;





在此先感谢..





thanks in advance..

推荐答案

您发布的连接字符串适用于纯ado.net.但是我想你有EntityFramework. EF的连接字符串稍微复杂一些.
在这里阅读有关如何构建它的信息: http://msdn.microsoft.com/en-us/library/bb738533.aspx [ ^ ]
以及如何编写: http://msdn.microsoft.com/en-us/library/cc716756. aspx [^ ]
The connection string you have posted are for plain ado.net. But I suppose you have EntityFramework. EF''s connection string is a little bit more complicated.
Read here about how to build it: http://msdn.microsoft.com/en-us/library/bb738533.aspx[^]
And how to write it: http://msdn.microsoft.com/en-us/library/cc716756.aspx[^]


这篇关于我没有在MVC 3中创建或使用现有数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆