我是ASP.NET新手,很難找到連接字符串。2連接字符串,安全字符串工作,實體框架1不是
我已經成功連接了下面2個連接字符串,數據庫安全性的連接字符串工作正常,但我無法獲得處理其餘數據的主字符串的工作。我認爲它必須是因爲連接字符串的實體框架元素。
對於元數據部分,我已經使用了res://*/
部分,因爲我認爲這樣效率較低,但如果我正確理解了我一直在閱讀的文檔,將會捕獲所有內容。
<remove name="ApplicationServices" />
<add name="ApplicationServices"
connectionString= "Server=184.168.194.64,1433;
Database= myASPNETDB;
User=****;
Password=****;"
providerName="System.Data.SqlClient" />
<remove name="PropManEntities" />
<add name="PropManEntities"
connectionString="Metadata=res://*/;
provider=System.Data.SqlClient;
provider connection string='Data Source=184.168.194.64,1433;
Initial Catalog=myTest_C;
User=****;
Password=****;
multipleactiveresultsets=true'"
providerName="System.Data.EntityClient" />
我收到以下錯誤,當我打開一個網頁的數據:
The query syntax is not valid. Near line 6, column 17.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.EntitySqlException: The query syntax is not valid. Near line 6, column 17.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[EntitySqlException: The query syntax is not valid. Near line 6, column 17.]
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +964
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
System.Web.UI.WebControls.DetailsView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +223
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()+75
System.Web.UI.Control.EnsureChildControls() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
GoDaddy的不願意提供這個方面的任何幫助。
編輯:
試圖利瑪竇的建議後,我得到了以下錯誤:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.]
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +8425830
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +43
System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +85
System.Data.Objects.ObjectContext..ctor(String connectionString) +12
System.Web.UI.WebControls.EntityDataSourceView.ConstructContext() +461
System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +102
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
System.Web.UI.WebControls.DetailsView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +223
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()+75
System.Web.UI.Control.EnsureChildControls() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Control.PreRenderRecursiveInternal() +155
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)+974
您是先使用Code還是從數據庫生成.edmx? – MrBliz
我不認爲元數據= res:// * /正在工作,如果是這樣,不要認爲這很方便,因爲如果您使用多個元數據,則會導致問題。來自其他組件的模型。嘗試設置正確的.csdl,.ssdl和.msl(如果您不知道它是什麼,請重新添加一個edmx並讓它爲您創建連接字符串)。 – Dacker
我讀到這個權利,你有兩個單獨的數據庫中的數據? – Claies